Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Actions to preview docs #511

Merged
merged 12 commits into from
Oct 23, 2023
30 changes: 30 additions & 0 deletions .github/workflows/build-adoc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Build Adoc

on:
pull_request:
paths:
- '*.adoc'

jobs:
pre-preview:
name: ADOC - Workflow
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7

- name: Build Jekyll site
uses: limjh16/jekyll-action-ts@v2
with:
enable_cache: true

- name: Publishing directory for PR preview
uses: actions/upload-artifact@v3
with:
name: site
path: ./_site
retention-days: 3
48 changes: 48 additions & 0 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Surge.sh Preview

on:
workflow_run:
workflows: ["Build Adoc"]
types:
- completed

jobs:
preview:
runs-on: ubuntu-latest
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
steps:
- name: Download PR Artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
workflow_conclusion: success
name: site
- name: Store PR id as variable
id: pr
run: |
echo "id=$(<pr-id.txt)" >> $GITHUB_OUTPUT
luanbrdev marked this conversation as resolved.
Show resolved Hide resolved
rm -f pr-id.txt
- name: Publishing to surge for preview
id: deploy
run: npx surge ./ --domain https://quarkus-openapi-generator-preview-pr-${{ steps.pr.outputs.id }}.surge.sh --token ${{ secrets.SURGE_TOKEN }}
- name: Update PR status comment on success
uses: actions-cool/maintain-one-comment@v3.0.0
luanbrdev marked this conversation as resolved.
Show resolved Hide resolved
with:
token: ${{ secrets.GITHUB_TOKEN }}
body: |
🎊 PR Preview ${{ github.sha }} has been successfully built and deployed to https://quarkus-openapi-generator-preview-pr-${{ steps.pr.outputs.id }}.surge.sh
<img width="300" src="https://user-images.githubusercontent.com/507615/90250366-88233900-de6e-11ea-95a5-84f0762ffd39.png">
<!-- Sticky Pull Request Comment -->
body-include: '<!-- Sticky Pull Request Comment -->'
number: ${{ steps.pr.outputs.id }}
- name: Update PR status comment on failure
if: ${{ failure() }}
uses: actions-cool/maintain-one-comment@v3.0.0
luanbrdev marked this conversation as resolved.
Show resolved Hide resolved
with:
token: ${{ secrets.GITHUB_TOKEN }}
body: |
😭 Deploy PR Preview failed.
<img width="300" src="https://user-images.githubusercontent.com/507615/90250824-4e066700-de6f-11ea-8230-600ecc3d6a6b.png">
<!-- Sticky Pull Request Comment -->
body-include: '<!-- Sticky Pull Request Comment -->'
number: ${{ steps.pr.outputs.id }}
24 changes: 24 additions & 0 deletions .github/workflows/preview_teardown.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Surge.sh Preview Teardown

on:
pull_request_target:
paths:
- '*.adoc'
types: [closed]

jobs:
preview-teardown:
runs-on: ubuntu-latest
steps:
- name: Teardown surge preview
id: deploy
run: npx surge teardown https://quarkus-openapi-generator-preview-pr-${{ github.event.number }}.surge.sh --token ${{ secrets.SURGE_TOKEN }}
- name: Update PR status comment
uses: actions-cool/maintain-one-comment@v3.0.0
luanbrdev marked this conversation as resolved.
Show resolved Hide resolved
with:
token: ${{ secrets.GITHUB_TOKEN }}
body: |
🙈 The PR is closed and the preview is expired.
<!-- Sticky Pull Request Comment -->
body-include: '<!-- Sticky Pull Request Comment -->'
number: ${{ github.event.number }}
91 changes: 91 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
GEM
remote: https://rubygems.org/
specs:
addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0)
asciidoctor (2.0.15)
colorator (1.1.0)
concurrent-ruby (1.1.8)
em-websocket (0.5.2)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0.6.0)
eventmachine (1.2.7)
ffi (1.15.0)
forwardable-extended (2.6.0)
http_parser.rb (0.6.0)
i18n (1.8.10)
concurrent-ruby (~> 1.0)
jekyll (4.1.1)
addressable (~> 2.4)
colorator (~> 1.0)
em-websocket (~> 0.5)
i18n (~> 1.0)
jekyll-sass-converter (~> 2.0)
jekyll-watch (~> 2.0)
kramdown (~> 2.1)
kramdown-parser-gfm (~> 1.0)
liquid (~> 4.0)
mercenary (~> 0.4.0)
pathutil (~> 0.9)
rouge (~> 3.0)
safe_yaml (~> 1.0)
terminal-table (~> 1.8)
jekyll-archives (2.2.1)
jekyll (>= 3.6, < 5.0)
jekyll-asciidoc (3.0.0)
asciidoctor (>= 1.5.0)
jekyll (>= 3.0.0)
jekyll-feed (0.15.1)
jekyll (>= 3.7, < 5.0)
jekyll-paginate-v2 (3.0.0)
jekyll (>= 3.0, < 5.0)
jekyll-sass-converter (2.1.0)
sassc (> 2.0.1, < 3.0)
jekyll-seo-tag (2.7.1)
jekyll (>= 3.8, < 5.0)
jekyll-watch (2.2.1)
listen (~> 3.0)
kramdown (2.3.1)
rexml
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
liquid (4.0.4)
listen (3.5.1)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
mercenary (0.4.0)
minima (2.5.1)
jekyll (>= 3.5, < 5.0)
jekyll-feed (~> 0.9)
jekyll-seo-tag (~> 2.1)
pathutil (0.16.2)
forwardable-extended (~> 2.6)
public_suffix (4.0.6)
rb-fsevent (0.11.0)
rb-inotify (0.10.1)
ffi (~> 1.0)
rexml (3.2.5)
rouge (3.26.0)
safe_yaml (1.0.5)
sassc (2.4.0)
ffi (~> 1.9)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
unicode-display_width (1.7.0)
webrick (1.7.0)

PLATFORMS
ruby

DEPENDENCIES
jekyll (~> 4.1.1)
jekyll-archives
jekyll-asciidoc
jekyll-feed (~> 0.6)
jekyll-paginate-v2
minima (~> 2.0)
tzinfo-data
webrick (~> 1.7)

BUNDLED WITH
2.2.16
37 changes: 37 additions & 0 deletions Gemfile.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
source "https://rubygems.org"

#ruby '2.5.0'

# Hello! This is where you manage which Jekyll version is used to run.
# When you want to use a different version, change it below, save the
# file and run `bundle install`. Run Jekyll with `bundle exec`, like so:
#
# bundle exec jekyll serve
#
# This will help ensure the proper Jekyll version is running.
# Happy Jekylling!
gem "jekyll", "~> 4.1.1"

# This is the default theme for new Jekyll sites. You may change this to anything you like.
gem "minima", "~> 2.0"

# If you want to use GitHub Pages, remove the "gem "jekyll"" above and
# uncomment the line below. To upgrade, run `bundle update github-pages`.
# gem "github-pages", group: :jekyll_plugins

# If you have any plugins, put them here!
group :jekyll_plugins do
gem "jekyll-feed", "~> 0.6"
gem 'jekyll-asciidoc'
gem 'jekyll-paginate-v2'
gem 'jekyll-archives'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby]

# Performance-booster for watching directories on Windows
gem "wdm", "~> 0.1.0" if Gem.win_platform?


gem "webrick", "~> 1.7"
44 changes: 44 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Welcome to Jekyll!
#
# This config file is meant for settings that affect your whole blog, values
# which you are expected to set up once and rarely edit after that. If you find
# yourself editing this file very often, consider using Jekyll's data files
# feature for the data you need to update frequently.
#
# For technical reasons, this file is *NOT* reloaded automatically when you use
# 'bundle exec jekyll serve'. If you change this file, please restart the server process.

# Site settings
# These are used to personalize your new site. If you look in the HTML files,
# you will see them accessed via {{ site.title }}, {{ site.email }}, and so on.
# You can create any custom variable you would like, and they will be accessible
# in the templates via {{ site.myvariable }}.
title: Quarkus Openapi Generator
email:
description: >- # this means to ignore newlines until "baseurl:"
Quarkus: Openapi Generator
baseurl: "" # the subpath of your site, e.g. /blog
url: "https://quarkus-openapi-generator-preview" # the base hostname & protocol for your site, e.g. http://example.com
github_username: quarkusio
github_fork_url: "https://github.com/quarkiverse/quarkus-openapi-generator"

# Build settings
error_mode: strict
markdown: kramdown
theme: minima
plugins:
- jekyll-feed
- jekyll-archives

sass:
style: compressed

asciidoctor:
base_dir: :docdir
safe: unsafe
attributes:
source-highlighter: highlightjs
sectanchors: ''
icons: font
outfilesuffix: ''
add-copy-button-to-env-var: true