61 lines
1.2 KiB
YAML
61 lines
1.2 KiB
YAML
name: site
|
|
|
|
on:
|
|
push:
|
|
branches: ["main"]
|
|
|
|
concurrency:
|
|
group: site-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: build
|
|
container:
|
|
image: node:24-bookworm
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install
|
|
run: npm ci --ignore-scripts --no-audit --no-fund
|
|
|
|
- name: Build
|
|
run: npm run build
|
|
|
|
- name: Validate
|
|
run: npm run check
|
|
|
|
- name: Upload
|
|
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: site
|
|
path: _site/
|
|
retention-days: 7
|
|
if-no-files-found: error
|
|
|
|
deploy:
|
|
needs: build
|
|
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
|
|
runs-on: deploy
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
|
|
steps:
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
name: site
|
|
path: _site
|
|
|
|
- name: Publish
|
|
env:
|
|
LIVE: /deploy
|
|
run: |
|
|
set -euo pipefail
|
|
|
|
# dont sync empty builds
|
|
test -f _site/index.html
|
|
|
|
rsync -trl --delete --chmod=D755,F644 _site/ "$LIVE/"
|
|
echo "deployed site." |