Skip to content

Commit 6a4eaad

Browse files
Publish workflow with Github app bypass
1 parent f240c82 commit 6a4eaad

File tree

1 file changed

+38
-35
lines changed

1 file changed

+38
-35
lines changed

.github/workflows/publish.yml

Lines changed: 38 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,52 @@
1-
name: Update Documentation
1+
name: Publish Documentation
22

33
on:
44
push:
5-
branches: [ main ]
6-
paths:
7-
- 'index.qmd'
8-
- '.github/workflows/update-docs.yml'
9-
workflow_dispatch:
5+
branches: main
106

117
jobs:
12-
update-docs:
8+
publish-documentation:
139
runs-on: ubuntu-latest
1410
permissions:
11+
id-token: write
1512
contents: write
1613
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+
1721
- name: Check out repository
1822
uses: actions/checkout@v4
1923
with:
2024
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
2138

2239
- name: Set up Quarto
2340
uses: quarto-dev/quarto-actions/setup@v2
2441

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+
2550
- name: Render Documentation
2651
run: |
2752
# Publish Quarto documentation
@@ -33,31 +58,9 @@ jobs:
3358
# Remove index.html if it exists
3459
rm -f index.html
3560
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

Comments
 (0)