mirror of
https://github.com/jbowdre/runtimeterror.git
synced 2024-11-21 22:42:19 +00:00
67 lines
No EOL
2.1 KiB
YAML
67 lines
No EOL
2.1 KiB
YAML
name: Build and Deploy Preview
|
|
|
|
# only run on changes to preview
|
|
on:
|
|
push:
|
|
branches:
|
|
- preview
|
|
workflow_dispatch:
|
|
|
|
concurrency: # prevent concurrent deploys doing strange things
|
|
group: deploy-preview
|
|
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@v3.0.0
|
|
with:
|
|
hugo-version: '0.127.0'
|
|
extended: true
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
submodules: recursive
|
|
- 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 }}
|
|
version: '1.68.1'
|
|
- name: Configure SSH known hosts
|
|
run: |
|
|
mkdir -p ~/.ssh
|
|
echo "${{ secrets.SSH_KNOWN_HOSTS }}" > ~/.ssh/known_hosts
|
|
chmod 644 ~/.ssh/known_hosts
|
|
- name: Build with Hugo
|
|
run: HUGO_REMOTE_FONT_PATH=${{ secrets.REMOTE_FONT_PATH }} hugo --minify --environment preview
|
|
- name: Insert 404 page
|
|
run: |
|
|
mkdir -p public/bunnycdn_errors
|
|
cp public/404/index.html public/bunnycdn_errors/404.html
|
|
- name: Highlight with Torchlight
|
|
run: |
|
|
npm i @torchlight-api/torchlight-cli
|
|
TORCHLIGHT_TOKEN=${{ secrets.TORCHLIGHT_TOKEN }} npx torchlight
|
|
- name: Deploy to Bunny
|
|
uses: ayeressian/bunnycdn-storage-deploy@v2.2.2
|
|
with:
|
|
source: public
|
|
destination: /
|
|
storageZoneName: "${{ secrets.BUNNY_STORAGE_NAME_PREVIEW }}"
|
|
storagePassword: "${{ secrets.BUNNY_STORAGE_PASSWORD_PREVIEW }}"
|
|
storageEndpoint: "${{ secrets.BUNNY_STORAGE_ENDPOINT }}"
|
|
accessKey: "${{ secrets.BUNNY_API_KEY }}"
|
|
pullZoneId: "${{ secrets.BUNNY_ZONE_ID_PREVIEW }}"
|
|
upload: "true"
|
|
remove: "true"
|
|
purgePullZone: "true" |