d75fe2b9a9
All checks were successful
Build and copy to prod / build-and-copy (push) Successful in 2m15s
52 lines
1.8 KiB
YAML
52 lines
1.8 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: Build eleventy
|
|
run: npm run build
|
|
env:
|
|
NODE_ENV: production
|
|
OMNIVORE_API_KEY: ${{ secrets.OMNIVORE_API_KEY }}
|
|
- name: Install SSH Key
|
|
uses: shimataro/ssh-key-action@v2
|
|
with:
|
|
key: ${{ secrets.SSH_KEY }}
|
|
known_hosts: ${{ secrets.SSH_KNOWN_HOSTS }}
|
|
- name: Copy _site to prod
|
|
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 }}' |