Skip to content

Commit c65ef5b

Browse files
committed
ci: modernize deployment workflow to use github actions pages
1 parent a100eef commit c65ef5b

1 file changed

Lines changed: 29 additions & 13 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@ on:
44
push:
55
branches:
66
- master
7+
workflow_dispatch:
8+
9+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
10+
permissions:
11+
contents: read
12+
pages: write
13+
id-token: write
14+
15+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
16+
concurrency:
17+
group: "pages"
18+
cancel-in-progress: false
719

820
jobs:
921
build:
@@ -12,8 +24,8 @@ jobs:
1224
- name: Checkout
1325
uses: actions/checkout@v4
1426
with:
15-
submodules: true # Fetch Hugo themes (true OR recursive)
16-
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
27+
submodules: true
28+
fetch-depth: 0
1729

1830
- name: Setup Hugo
1931
uses: peaceiris/actions-hugo@v2
@@ -24,14 +36,18 @@ jobs:
2436
- name: Build
2537
run: hugo --minify
2638

27-
- name: Deploy
28-
run: |
29-
git config --global user.name "github-actions[bot]"
30-
git config --global user.email "github-actions[bot]@users.noreply.github.com"
31-
git add docs/
32-
if git diff --staged --quiet; then
33-
echo "No changes to commit"
34-
exit 0
35-
fi
36-
git commit -m "Deploy to docs/ [skip ci]"
37-
git push
39+
- name: Upload artifact
40+
uses: actions/upload-pages-artifact@v3
41+
with:
42+
path: ./docs
43+
44+
deploy:
45+
environment:
46+
name: github-pages
47+
url: ${{ steps.deployment.outputs.page_url }}
48+
runs-on: ubuntu-latest
49+
needs: build
50+
steps:
51+
- name: Deploy to GitHub Pages
52+
id: deployment
53+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)