[2.x] github pages #2
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: docs | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
builder: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: redoc-cli | |
uses: fluximus-prime/redocly-cli-github-action@v1 | |
with: | |
args: 'build-docs api.yaml -o docs/index.html' | |
- name: "Check if build has changed" | |
if: success() | |
id: has-changes | |
run: | | |
echo "stdout<<EOF" >> $GITHUB_OUTPUT | |
echo "$(git diff --stat)" >> $GITHUB_OUTPUT | |
echo 'EOF' >> $GITHUB_OUTPUT | |
- name: Import GPG key | |
if: ${{ steps.has-changes.outputs.stdout }} | |
uses: crazy-max/ghaction-import-gpg@v6 | |
with: | |
gpg_private_key: ${{ secrets.GPG_BOT }} | |
passphrase: ${{ secrets.GPG_PASSPHRASE }} | |
fingerprint: ${{ secrets.GPG_FINGERPRINT }} | |
git_config_global: true | |
git_user_signingkey: true | |
git_commit_gpgsign: true | |
git_committer_name: Github bot | |
git_committer_email: [email protected] | |
- name: "Commit files" | |
if: ${{ steps.has-changes.outputs.stdout }} | |
env: | |
GH_TOKEN: ${{ secrets.BOT_TOKEN }} | |
run: | | |
gh pr checkout ${{ github.event.pull_request.number }} | |
git commit -S -m "github pages generated" -a | |
- name: "Push changes" | |
if: ${{ steps.has-changes.outputs.stdout }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} | |
run: git push -u origin HEAD |