runtimeterror/.github/workflows/deploy-preview.yml

62 lines
1.8 KiB
YAML
Raw Normal View History

2024-06-07 00:41:43 +00:00
name: Build and Deploy Preview
2024-01-23 19:07:54 +00:00
# only run on changes to preview
on:
push:
branches:
- preview
2024-06-06 23:10:08 +00:00
workflow_dispatch:
2024-01-23 19:07:54 +00:00
concurrency: # prevent concurrent deploys doing strange things
2024-04-23 17:26:08 +00:00
group: deploy-preview
2024-01-23 19:07:54 +00:00
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
2024-04-23 17:26:08 +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 }}
- name: Configure SSH known hosts
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SSH_KNOWN_HOSTS }}" > ~/.ssh/known_hosts
chmod 644 ~/.ssh/known_hosts
2024-01-23 19:07:54 +00:00
- name: Build with Hugo
2024-04-23 17:26:08 +00:00
run: HUGO_REMOTE_FONT_PATH=${{ secrets.REMOTE_FONT_PATH }} hugo --minify --environment preview
2024-01-23 19:07:54 +00:00
- name: Highlight with Torchlight
run: |
npm i @torchlight-api/torchlight-cli
npx torchlight
2024-06-06 23:05:16 +00:00
- name: Deploy to Bunny
uses: ayeressian/bunnycdn-storage-deploy@v2.2.2
2024-01-23 19:07:54 +00:00
with:
2024-06-06 23:05:16 +00:00
source: public
destination: /
2024-06-07 00:41:43 +00:00
storageZoneName: "${{ secrets.BUNNY_STORAGE_NAME_PREVIEW }}"
storagePassword: "${{ secrets.BUNNY_STORAGE_PASSWORD_PREVIEW }}"
2024-06-06 23:10:08 +00:00
storageEndpoint: "${{ secrets.BUNNY_STORAGE_ENDPOINT }}"
2024-06-06 23:15:15 +00:00
accessKey: "${{ secrets.BUNNY_API_KEY }}"
2024-06-07 00:41:43 +00:00
pullZoneId: "${{ secrets.BUNNY_ZONE_ID_PREVIEW }}"
2024-06-06 23:05:16 +00:00
upload: "true"
remove: "true"
purgePullZone: "true"