Files

74 lines
1.7 KiB
YAML

name: Update Documentation
on:
push:
branches:
- main
paths:
- 'Casks/**'
- 'Formula/**'
- '.github/workflows/docs.yml'
- 'scripts/generate-docs.sh'
workflow_dispatch:
permissions:
contents: write
pages: write
id-token: write
jobs:
update-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Generate documentation
run: |
chmod +x scripts/generate-docs.sh
./scripts/generate-docs.sh
- name: Check for changes
id: check-changes
run: |
if git diff --quiet docs/index.html; then
echo "changed=false" >> "$GITHUB_OUTPUT"
else
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
- name: Commit and push changes
if: steps.check-changes.outputs.changed == 'true'
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add docs/
git commit -m "docs: auto-update documentation from casks"
git push
deploy-pages:
needs: update-docs
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: main
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: 'docs'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4