[READ-ONLY] Mirror of https://github.com/flo-bit/blog-template. minimalistic astro blog template
flo-bit.dev/blog-template/
astro
blog
template
1.2 kB
46 lines
1name: Deploy to GitHub Pages
2
3on:
4 push:
5 branches: [main]
6 workflow_dispatch:
7
8permissions:
9 contents: read
10 pages: write
11 id-token: write
12
13jobs:
14 build:
15 runs-on: ubuntu-latest
16 steps:
17 - name: Checkout your repository using git
18 uses: actions/checkout@v4
19
20 - name: Set SITE and BASE values if MANUAL_SITE_BASE is false
21 run: |
22 if jq '.MANUAL_SITE_BASE == false' src/config.json; then
23 SITE="https://$GITHUB_ACTOR.github.io"
24 REPO_NAME="${GITHUB_REPOSITORY#*/}"
25 if [ "$REPO_NAME" = "$GITHUB_ACTOR.github.io" ]; then
26 BASE=""
27 else
28 BASE="/$REPO_NAME"
29 fi
30 jq --arg SITE "$SITE" --arg BASE "$BASE" \
31 '.SITE = $SITE | .BASE = $BASE' src/config.json > tmp.$$.json && mv tmp.$$.json src/config.json
32 fi
33
34 - name: Install, build, and upload your site
35 uses: withastro/action@v3
36
37 deploy:
38 needs: build
39 runs-on: ubuntu-latest
40 environment:
41 name: github-pages
42 url: ${{ steps.deployment.outputs.page_url }}
43 steps:
44 - name: Deploy to GitHub Pages
45 id: deployment
46 uses: actions/deploy-pages@v4