devon.lol/.forgejo/workflows/build-eleventy.yaml

45 lines
1.2 KiB
YAML
Raw Permalink Normal View History

2025-02-07 21:39:15 -05:00
name: Build Eleventy Site
on: [push]
2025-03-03 19:12:50 -05:00
env:
WEBMENTIONSIO_TOKEN: ${{ secrets.WEBMENTIONSIO_TOKEN }}
2025-03-04 19:31:45 -05:00
TZ: America/New_York
2025-03-03 19:12:50 -05:00
2025-02-07 21:39:15 -05:00
jobs:
build:
runs-on: docker
container:
image: node:18
volumes:
# This is the path mounted in the Forgejo stack's docker-compose
- /sites:/sites
2025-02-07 21:39:15 -05:00
steps:
- name: Checkout code
run: |
git clone ${{ github.server_url }}/${{ github.repository }} .
git fetch origin ${{ github.ref }}
git checkout FETCH_HEAD
- name: Install dependencies
run: npm install
- name: Build Eleventy site
2025-03-03 22:15:14 -05:00
run: npm run build
2025-02-07 21:39:15 -05:00
- name: Move built site
run: |
2026-06-08 23:28:41 -04:00
set -e # Exit on any error
if [ "${{ github.ref }}" = "refs/heads/main" ]; then
2025-03-03 22:15:14 -05:00
echo "Deploying production..."
rm -rf /sites/devon.lol && mkdir /sites/devon.lol && mv dist/* /sites/devon.lol
2025-02-07 21:39:15 -05:00
echo "Running webmention..."
2025-03-04 19:39:46 -05:00
echo "ls dist:"
ls dist
npx webmention /sites/devon.lol/feed.xml --send
2025-02-07 21:39:15 -05:00
else
2025-03-03 22:15:14 -05:00
echo "Deploying staging..."
rm -rf /sites/staging.devon.lol && mkdir /sites/staging.devon.lol && mv dist/* /sites/staging.devon.lol
2025-02-07 21:39:15 -05:00
fi