A change of seasons... #53
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright (c) 2023 Paul Barker <paul@pbarker.dev> | |
# SPDX-License-Identifier: Apache-2.0 | |
name: Build website | |
on: [push, pull_request] | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v3 | |
- name: Setup Python 3.10 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
cache: "pip" | |
- name: Install dependencies | |
run: pip install -r requirements.txt | |
- name: Build website with Pelican | |
run: | | |
if [[ $GITHUB_REF == 'refs/heads/main' ]]; then | |
inv build --prod | |
else | |
inv build | |
fi | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: public | |
path: public | |
deploy: | |
name: Deploy | |
needs: build | |
if: github.repository == 'unnecessary-abstraction/pbarker.dev' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: public | |
path: public | |
- name: Deploy to Cloudflare Pages | |
uses: cloudflare/pages-action@v1 | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
projectName: pbarker | |
directory: public | |
branch: ${{ github.ref_name }} |