|
1 |
| -name: Update Documentation |
| 1 | +name: Publish Documentation |
2 | 2 |
|
3 | 3 | on:
|
4 | 4 | push:
|
5 |
| - branches: [ main ] |
6 |
| - paths: |
7 |
| - - 'index.qmd' |
8 |
| - - '.github/workflows/update-docs.yml' |
9 |
| - workflow_dispatch: |
| 5 | + branches: main |
10 | 6 |
|
11 | 7 | jobs:
|
12 |
| - update-docs: |
| 8 | + publish-documentation: |
13 | 9 | runs-on: ubuntu-latest
|
14 | 10 | permissions:
|
| 11 | + id-token: write |
15 | 12 | contents: write
|
16 | 13 | steps:
|
| 14 | + - name: Generate token for version incrementer app |
| 15 | + id: create_token |
| 16 | + uses: tibdex/github-app-token@v2 |
| 17 | + with: |
| 18 | + app_id: ${{ secrets.APP_ID }} |
| 19 | + private_key: ${{ secrets.PRIVATE_KEY }} |
| 20 | + |
17 | 21 | - name: Check out repository
|
18 | 22 | uses: actions/checkout@v4
|
19 | 23 | with:
|
20 | 24 | fetch-depth: 0
|
| 25 | + ref: ${{ github.sha }} |
| 26 | + token: ${{ steps.create_token.outputs.token }} |
| 27 | + |
| 28 | + - name: Install uv |
| 29 | + uses: astral-sh/setup-uv@v5 |
| 30 | + |
| 31 | + - name: "Set up Python" |
| 32 | + uses: actions/setup-python@v5 |
| 33 | + with: |
| 34 | + python-version-file: "pyproject.toml" |
| 35 | + |
| 36 | + - name: Install dependencies |
| 37 | + run: uv sync |
21 | 38 |
|
22 | 39 | - name: Set up Quarto
|
23 | 40 | uses: quarto-dev/quarto-actions/setup@v2
|
24 | 41 |
|
| 42 | + - name: Configure Git |
| 43 | + run: | |
| 44 | + git config --global user.name "github-actions[bot]" |
| 45 | + git config --global user.email "github-actions[bot]@users.noreply.github.com" |
| 46 | +
|
| 47 | + - name: Render and Publish |
| 48 | + run: uv run quarto publish gh-pages --no-prompt --no-browser |
| 49 | + |
25 | 50 | - name: Render Documentation
|
26 | 51 | run: |
|
27 | 52 | # Publish Quarto documentation
|
|
33 | 58 | # Remove index.html if it exists
|
34 | 59 | rm -f index.html
|
35 | 60 |
|
36 |
| - - name: Commit and Push Changes |
37 |
| - run: | |
38 |
| - git config --local user.email "github-actions[bot]@users.noreply.github.com" |
39 |
| - git config --local user.name "github-actions[bot]" |
40 |
| - |
41 |
| - # Stage only specific files |
42 |
| - git add README.md |
43 |
| - |
44 |
| - # Only commit if there are changes |
45 |
| - git diff --staged --quiet || git commit -m "docs: Update README.md via automated workflow" |
46 |
| - |
47 |
| - # Push changes |
48 |
| - git push |
49 |
| -
|
50 |
| - # Optional step for generating additional documentation files |
51 |
| - - name: Generate Additional Documentation |
52 |
| - if: false # Disabled by default - enable when needed |
53 |
| - run: | |
54 |
| - # Example: Generate .txt version |
55 |
| - quarto render index.qmd --output-dir . --output rules.txt --to plain |
56 |
| - |
57 |
| - # Example: Generate .cursorrules version |
58 |
| - quarto render index.qmd --output-dir . --output rules.cursorrules --to plain |
59 |
| - |
60 |
| - # Commit and push additional files |
61 |
| - git add rules.txt rules.cursorrules |
62 |
| - git diff --staged --quiet || git commit -m "docs: Update additional documentation files" |
63 |
| - git push |
| 61 | + - name: Commit version change |
| 62 | + uses: stefanzweifel/git-auto-commit-action@v5 |
| 63 | + with: |
| 64 | + commit_message: "Update README" |
| 65 | + branch: ${{ github.ref_name }} |
| 66 | + file_pattern: "README.md" |
0 commit comments