SmallRye Website - On Demand #8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: SmallRye Website - On Demand | |
on: | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
services: | |
kroki: | |
image: yuzutech/kroki | |
env: | |
KROKI_MERMAID_HOST: kroki-mermaid | |
ports: | |
- 8000:8000 | |
kroki-mermaid: | |
image: yuzutech/kroki-mermaid | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: set up ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 2.6 | |
- name: generate website | |
env: | |
JEKYLL_ENV: production | |
run: | | |
mkdir website | |
bundle install | |
bundle exec jekyll build --destination website | |
- name: generate docs | |
run: | | |
cd docs | |
npm i @antora/[email protected] @antora/[email protected] asciidoctor-kroki | |
./node_modules/@antora/cli/bin/antora antora generate antora-playbook.yml | |
cd .. | |
cp -r docs/build/site website/docs | |
- name: attach website | |
uses: actions/upload-artifact@v4 | |
with: | |
name: website | |
path: website | |
deploy: | |
needs: [build] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/create-github-app-token@v1 | |
id: app-token | |
name: Create GitHub App Token | |
with: | |
app-id: ${{ vars.CI_APP_ID }} | |
private-key: ${{ secrets.CI_APP_PRIVATE_KEY }} | |
- uses: actions/checkout@v4 | |
with: | |
ref: main | |
token: ${{steps.app-token.outputs.token}} | |
- name: Get GitHub App User ID | |
id: get-user-id | |
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT" | |
env: | |
GH_TOKEN: ${{ steps.app-token.outputs.token }} | |
- name: Configure Git author | |
run: | | |
git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]' | |
git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com>' | |
- name: extract website | |
uses: actions/download-artifact@v4 | |
with: | |
name: website | |
- name: push website | |
run: | | |
git status | |
git diff | |
git add -A . | |
git commit -m "CI: Build and deploy website updates" | |
git push --force |