2024-02-28 01:09:21 +00:00
|
|
|
name: Deploy to Production
|
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-01-21 03:38:40 +00:00
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
|
|
|
|
concurrency: # prevent concurrent deploys doing strange things
|
2024-02-28 01:09:21 +00:00
|
|
|
group: deploy-to-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
|
|
|
|
uses: peaceiris/actions-hugo@v2.6.0
|
|
|
|
with:
|
|
|
|
hugo-version: '0.121.1'
|
|
|
|
extended: true
|
2024-01-21 03:38:40 +00:00
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
submodules: recursive
|
|
|
|
- name: Build with Hugo
|
2024-01-21 21:12:41 +00:00
|
|
|
run: hugo --minify
|
2024-01-21 19:04:43 +00:00
|
|
|
- name: Insert 404 page
|
|
|
|
run: |
|
2024-01-21 23:41:20 +00:00
|
|
|
cp public/404/index.html public/not_found.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
|
|
|
|
npx torchlight
|
2024-02-28 01:09:21 +00:00
|
|
|
- name: Deploy HTML to Neocities
|
2024-01-21 03:38:40 +00:00
|
|
|
uses: bcomnes/deploy-to-neocities@v1
|
|
|
|
with:
|
|
|
|
api_token: ${{ secrets.NEOCITIES_API_TOKEN }}
|
2024-01-21 21:31:14 +00:00
|
|
|
cleanup: true
|
2024-02-28 01:09:21 +00:00
|
|
|
dist_dir: public
|
|
|
|
- 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-02-28 01:21:46 +00:00
|
|
|
- name: Cache SSH known hosts
|
2024-02-28 01:09:21 +00:00
|
|
|
run: |
|
2024-02-28 01:11:43 +00:00
|
|
|
mkdir -p ~/.ssh
|
2024-02-28 01:09:21 +00:00
|
|
|
ssh-keyscan -H ${{ secrets.GMI_HOST }} >> ~/.ssh/known_hosts
|
2024-02-28 01:21:46 +00:00
|
|
|
- name: Deploy GMI to Agate
|
|
|
|
run: |
|
|
|
|
which rsync
|
|
|
|
rsync -avz --delete --exclude='*.html' --exclude='*.css' --exclude='*.js' -e ssh public/ ${{ secrets.GMI_USER }}@${{ secrets.GMI_HOST }}:${{ secrets.GMI_CONTENT_PATH }}
|
2024-02-28 01:09:21 +00:00
|
|
|
|