Skip to content

Commit 09c8a79

Browse files
committed
add gha build workflow for docs
1 parent ec504d1 commit 09c8a79

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

.github/workflows/docs.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Deploy Documentation to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [main]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
13+
jobs:
14+
check-deploy:
15+
runs-on: ubuntu-latest
16+
outputs:
17+
should_deploy: ${{ steps.check.outputs.should_deploy }}
18+
steps:
19+
- name: Check commit message for [gh-pages]
20+
id: check
21+
run: |
22+
if [[ "${{ github.event.head_commit.message }}" == *"[gh-pages]"* ]] || [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
23+
echo "should_deploy=true" >> $GITHUB_OUTPUT
24+
else
25+
echo "should_deploy=false" >> $GITHUB_OUTPUT
26+
fi
27+
28+
build:
29+
needs: check-deploy
30+
if: needs.check-deploy.outputs.should_deploy == 'true'
31+
runs-on: ubuntu-latest
32+
steps:
33+
- name: Checkout
34+
uses: actions/checkout@v4
35+
36+
- name: Build with Astro
37+
uses: withastro/action@v2
38+
with:
39+
path: docs
40+
41+
deploy:
42+
needs: build
43+
runs-on: ubuntu-latest
44+
environment:
45+
name: github-pages
46+
url: ${{ steps.deployment.outputs.page_url }}
47+
steps:
48+
- name: Deploy to GitHub Pages
49+
id: deployment
50+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)