runtimeterror/.github/workflows/deploy-to-prod.yml

61 lines
1.6 KiB
YAML

name: Deploy to Production
# only run on changes to main
on:
schedule:
- cron: 0 13 * * *
push:
branches:
- main
concurrency: # prevent concurrent deploys doing strange things
group: deploy-to-prod
cancel-in-progress: true
# Default to bash
defaults:
run:
shell: bash
jobs:
deploy:
name: Build and deploy Hugo site
runs-on: ubuntu-latest
steps:
- name: Hugo setup
uses: peaceiris/actions-hugo@v2.6.0
with:
hugo-version: '0.121.1'
extended: true
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Build with Hugo
run: hugo --minify
- name: Insert 404 page
run: |
cp public/404/index.html public/not_found.html
- name: Highlight with Torchlight
run: |
npm i @torchlight-api/torchlight-cli
npx torchlight
- name: Deploy HTML to Neocities
uses: bcomnes/deploy-to-neocities@v1
with:
api_token: ${{ secrets.NEOCITIES_API_TOKEN }}
cleanup: true
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 }}
- name: Deploy GMI to Agate
run: |
mkdir -p ~/.ssh
ssh-keyscan -H ${{ secrets.GMI_HOST }} >> ~/.ssh/known_hosts
rsync -avz --delete --exclude='*.html' --exclude='*.css' --exclude='*.js' -e ssh public/ ${{ secrets.GMI_HOST }}:${{ secrets.GMI_CONTENT_PATH }}