lewisdale.dev/.gitea/workflows/build-and-copy.yml
Lewis Dale 74966a23f6
Some checks failed
Build and copy to prod / build-and-copy (push) Has been cancelled
Trigger deploy / trigger-deploy (push) Has been cancelled
Try uploading to Bunny
2024-11-11 15:45:36 +00:00

59 lines
2.0 KiB
YAML

name: Build and copy to prod
on:
push:
schedule:
- cron: '0 * * * *'
jobs:
build-and-copy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 20.x
- 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
UMAMI_API_KEY: ${{ secrets.UMAMI_API_KEY }}
- name: Sync to Bunny
run: node ./scripts/upload-to-bunny.js
env:
BUNNY_STORAGE_ENDPOINT: ${{ secrets.BUNNY_STORAGE_ENDPOINT }}
BUNNY_STORAGE_PASSWORD: ${{ secrets.BUNNY_STORAGE_PASSWORD }}
BUNNY_STORAGE_BUCKET: ${{ secrets.BUNNY_STORAGE_BUCKET }}
- 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 }}'