2024-03-07 13:49:38 +00:00
|
|
|
name: Build and copy to prod
|
|
|
|
on:
|
|
|
|
push:
|
2024-03-08 08:32:17 +00:00
|
|
|
schedule:
|
|
|
|
- cron: '@hourly'
|
2024-03-07 13:49:38 +00:00
|
|
|
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 📦
|
2024-03-07 13:51:48 +00:00
|
|
|
run: npm ci
|
2024-03-07 14:55:01 +00:00
|
|
|
- name: Cache build
|
|
|
|
id: cache-eleventy-build
|
|
|
|
uses: actions/cache@v4
|
|
|
|
with:
|
|
|
|
path: .cache
|
2024-03-08 08:29:28 +00:00
|
|
|
key: cache-eleventy-build-${{ gitea.run_id }}
|
|
|
|
restore-keys: |
|
|
|
|
cache-eleventy-build
|
2024-03-07 13:49:38 +00:00
|
|
|
- name: Build eleventy
|
2024-03-07 13:51:48 +00:00
|
|
|
run: npm run build
|
2024-03-07 13:49:38 +00:00
|
|
|
env:
|
|
|
|
NODE_ENV: production
|
|
|
|
OMNIVORE_API_KEY: ${{ secrets.OMNIVORE_API_KEY }}
|
2024-03-07 14:06:01 +00:00
|
|
|
- name: Install SSH Key
|
|
|
|
uses: shimataro/ssh-key-action@v2
|
|
|
|
with:
|
|
|
|
key: ${{ secrets.SSH_KEY }}
|
2024-03-07 14:26:07 +00:00
|
|
|
known_hosts: ${{ secrets.SSH_KNOWN_HOSTS }}
|
2024-03-07 14:02:57 +00:00
|
|
|
- name: Copy _site to prod
|
2024-04-26 10:47:12 +00:00
|
|
|
run: scp -rp _site/* ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:/var/www/blog/
|
|
|
|
- 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 }}'
|