lewisdale.dev/.gitea/workflows/build-and-copy.yaml
Lewis Dale d30f404b4e
Some checks failed
Build and copy to prod / build-and-copy (push) Failing after 3m31s
Do docker setup _before_ build, it's overwriting the _site directory
2024-10-18 19:50:09 +01:00

71 lines
2.3 KiB
YAML

name: Build and copy to prod
on:
push:
schedule:
- cron: '0 * * * *'
jobs:
build-and-copy:
runs-on: ubuntu-latest
container:
image: catthehacker/ubuntu:act-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 20.x
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to gitea container registry
uses: docker/login-action@v3
with:
registry: git.lewisdale.dev
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Install dependencies 📦
run: npm ci
- name: Cache build
id: cache-eleventy-build
uses: actions/cache@v4
with:
path: .cache
key: cache-eleventy-build-${{ gitea.run_id }}
restore-keys: |
cache-eleventy-build
- name: Cache _site
id: cache-site
uses: actions/cache@v4
with:
path: _site
key: cache-site-${{ gitea.run_id }}
restore-keys: |
cache-site
- name: Build eleventy
run: npm run build
env:
NODE_ENV: production
OMNIVORE_API_KEY: ${{ secrets.OMNIVORE_API_KEY }}
UMAMI_API_KEY: ${{ secrets.UMAMI_API_KEY }}
- name: Build and push
uses: docker/build-push-action@v6
with:
push: true
tags: git.lewisdale.dev/lewis/blog:latest
- name: Purge XML files from cache
run: |
curl --request POST \
--url 'https://api.bunny.net/purge?url=https%3A%2F%2Flewisdale.dev%2F%2A.xml&async=false' \
--header 'AccessKey: ${{ secrets.BUNNY_ACCESS_KEY }}'
- name: Purge JSON files from cache
run: |
curl --request POST \
--url 'https://api.bunny.net/purge?url=https%3A%2F%2Flewisdale.dev%2F%2A.json&async=false' \
--header 'AccessKey: ${{ secrets.BUNNY_ACCESS_KEY }}'
- name: Purge CSS files from cache
run: |
curl --request POST \
--url 'https://api.bunny.net/purge?url=https%3A%2F%2Flewisdale.dev%2F%2A.css&async=false' \
--header 'AccessKey: ${{ secrets.BUNNY_ACCESS_KEY }}'