Skip to content

Deploy

Deploy #129

Workflow file for this run

name: Deploy
on:
push:
branches: [main]
schedule:
- cron: '1 0 * * *' # every day at 00:01 UTC to make sure the speaking page is up to date
workflow_dispatch: {} # manual release
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: 'pages'
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Begin CI...
uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: 8
- name: Use Node 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'pnpm'
cache-dependency-path: 'pnpm-lock.yaml'
- name: Restore build cache
uses: actions/cache@v3
with:
path: |
dist
.astro
key: ${{ runner.os }}-astro-build-${{ hashFiles('dist') }}
restore-keys: |
${{ runner.os }}-astro-build-
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build
run: pnpm build
- name: Fix permissions
run: |
chmod -c -R +rX "dist/" | while read line; do
echo "::warning title=Invalid file permissions automatically fixed::$line"
done
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: dist
deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
uses: actions/deploy-pages@v4
id: deployment
with:
preview: ${{ github.ref_name != 'main' }}
- name: Cleanup CDN Cache
if: ${{ github.ref_name == 'main' }}
run: |
curl -X DELETE "https://api.cloudflare.com/client/v4/zones/${{ secrets.CLOUDFLARE_ZONE }}/purge_cache" \
-H "X-Auth-Email: ${{ secrets.CLOUDFLARE_EMAIL }}" \
-H "X-Auth-Key: ${{ secrets.CLOUDFLARE_AUTH_KEY }}" \
-H "Content-Type: application/json" \
--data '{"purge_everything":true}'