Skip to content

Deploy

Deploy #369

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: Install linux dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.9.13'
- name: Begin CI...
uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: 9
- 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}'