This repository was archived by the owner on Dec 8, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (74 loc) · 2.55 KB
/
deploy-githubpages.yml
File metadata and controls
80 lines (74 loc) · 2.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# This file is required to build astro for GH Pages
# https://docs.astro.build/en/guides/deploy/github/
name: Deploy to GitHub Pages
on:
# Trigger the workflow every time you push to the `main` branch
# Using a different branch name? Replace `main` with your branch’s name
push:
branches:
- main
# Allows you to run this workflow manually from the Actions tab on GitHub.
workflow_dispatch:
# Allow this job to clone the repo and create a page deployment
permissions:
contents: read
pages: write
id-token: write
jobs:
update-submodules:
runs-on: ubuntu-latest
outputs:
submodules_updated: ${{ steps.commit.outputs.submodules_updated }}
steps:
- name: Checkout your repository using git
uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.GHA_THEAETHER_ASTRO }}
- name: Update submodules to latest commit on default branch
id: update
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git submodule update --init --recursive
git submodule foreach '
branch=$(git remote show origin | awk "/HEAD branch/ {print \$NF}")
git fetch origin $branch
git checkout $branch
git pull origin $branch
'
- name: Commit submodule changes if any
id: commit
run: |
git add .
if git diff --cached --quiet; then
echo "No changes to commit"
echo "submodules_updated=false" >> $GITHUB_OUTPUT
else
git commit -m "Update submodules to latest commit on default branch"
git push origin HEAD:main
echo "submodules_updated=true" >> $GITHUB_OUTPUT
fi
build:
needs: update-submodules
if: needs.update-submodules.outputs.submodules_updated == 'false'
runs-on: ubuntu-latest
steps:
- name: Checkout your repository using git
uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.GHA_THEAETHER_ASTRO }}
- name: Install, build, and upload your site
uses: withastro/action@v3
deploy:
needs: build
if: needs.update-submodules.outputs.submodules_updated == 'false'
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4