2024-06-07 00:58:17 +00:00
|
|
|
name: Build and Deploy Prod
|
2024-01-21 03:38:40 +00:00
|
|
|
|
|
|
|
# only run on changes to main
|
|
|
|
on:
|
2024-01-22 01:17:33 +00:00
|
|
|
schedule:
|
|
|
|
- cron: 0 13 * * *
|
2024-03-03 22:21:31 +00:00
|
|
|
workflow_dispatch:
|
2024-01-21 03:38:40 +00:00
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
|
|
|
|
concurrency: # prevent concurrent deploys doing strange things
|
2024-04-23 17:25:46 +00:00
|
|
|
group: deploy-prod
|
2024-01-21 03:38:40 +00:00
|
|
|
cancel-in-progress: true
|
|
|
|
|
|
|
|
# Default to bash
|
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
shell: bash
|
|
|
|
|
|
|
|
jobs:
|
2024-01-21 21:29:49 +00:00
|
|
|
deploy:
|
|
|
|
name: Build and deploy Hugo site
|
2024-01-21 05:15:10 +00:00
|
|
|
runs-on: ubuntu-latest
|
2024-01-21 03:38:40 +00:00
|
|
|
steps:
|
2024-01-21 20:58:23 +00:00
|
|
|
- name: Hugo setup
|
2024-06-29 01:40:59 +00:00
|
|
|
uses: peaceiris/actions-hugo@v3.0.0
|
2024-01-21 20:58:23 +00:00
|
|
|
with:
|
2024-06-29 01:40:59 +00:00
|
|
|
hugo-version: '0.127.0'
|
2024-01-21 20:58:23 +00:00
|
|
|
extended: true
|
2024-01-21 03:38:40 +00:00
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
submodules: recursive
|
2024-04-20 22:31:14 +00:00
|
|
|
- name: Connect to Tailscale
|
|
|
|
uses: tailscale/github-action@v2
|
|
|
|
with:
|
|
|
|
oauth-client-id: ${{ secrets.TS_API_CLIENT_ID }}
|
|
|
|
oauth-secret: ${{ secrets.TS_API_CLIENT_SECRET }}
|
|
|
|
tags: ${{ secrets.TS_TAG }}
|
2024-06-27 13:39:56 +00:00
|
|
|
version: '1.68.1'
|
2024-04-20 22:31:14 +00:00
|
|
|
- name: Configure SSH known hosts
|
|
|
|
run: |
|
|
|
|
mkdir -p ~/.ssh
|
|
|
|
echo "${{ secrets.SSH_KNOWN_HOSTS }}" > ~/.ssh/known_hosts
|
|
|
|
chmod 644 ~/.ssh/known_hosts
|
2024-01-21 03:38:40 +00:00
|
|
|
- name: Build with Hugo
|
2024-07-30 01:05:42 +00:00
|
|
|
run: |
|
|
|
|
HUGO_REMOTE_FONT_PATH=${{ secrets.REMOTE_FONT_PATH }} \
|
|
|
|
hugo --minify
|
2024-06-08 02:51:50 +00:00
|
|
|
- name: Insert 404 page
|
|
|
|
run: |
|
|
|
|
mkdir -p public/bunnycdn_errors
|
|
|
|
cp public/404/index.html public/bunnycdn_errors/404.html
|
2024-01-21 03:38:40 +00:00
|
|
|
- name: Highlight with Torchlight
|
2024-01-21 13:59:53 +00:00
|
|
|
run: |
|
|
|
|
npm i @torchlight-api/torchlight-cli
|
2024-06-07 01:40:59 +00:00
|
|
|
TORCHLIGHT_TOKEN=${{ secrets.TORCHLIGHT_TOKEN }} npx torchlight
|
2024-06-07 00:58:17 +00:00
|
|
|
- name: Deploy to Bunny
|
|
|
|
uses: ayeressian/bunnycdn-storage-deploy@v2.2.2
|
2024-01-21 03:38:40 +00:00
|
|
|
with:
|
2024-06-07 00:58:17 +00:00
|
|
|
source: public
|
|
|
|
destination: /
|
|
|
|
storageZoneName: "${{ secrets.BUNNY_STORAGE_NAME }}"
|
|
|
|
storagePassword: "${{ secrets.BUNNY_STORAGE_PASSWORD }}"
|
|
|
|
storageEndpoint: "${{ secrets.BUNNY_STORAGE_ENDPOINT }}"
|
|
|
|
accessKey: "${{ secrets.BUNNY_API_KEY }}"
|
|
|
|
pullZoneId: "${{ secrets.BUNNY_ZONE_ID }}"
|
|
|
|
upload: "true"
|
|
|
|
remove: "true"
|
2024-10-20 03:53:33 +00:00
|
|
|
purgePullZone: "true"
|