Skip to content

Commit

Permalink
Add GitHub CI workflow that deploys to Cloudflare Pages
Browse files Browse the repository at this point in the history
  • Loading branch information
MitchellCash committed Sep 7, 2023
1 parent bc855cf commit 403f155
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: CI

# Trigger workflow on push and pull requests.
on: [push, pull_request]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install dependencies
run: npm ci
- name: Lint
run: npm run lint

build:
runs-on: ubuntu-latest
needs: ["lint"]
strategy:
matrix:
node-version: [18]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node v${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Upload static site artifact
uses: actions/upload-artifact@v3
with:
name: static-site
path: out
retention-days: 1

publish:
runs-on: ubuntu-latest
needs: ["build"]
steps:
- name: Download static site artifact
uses: actions/download-artifact@master
with:
name: static-site
path: out
- name: Publish to Cloudflare Pages
uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: "personal-website"
folder: out

0 comments on commit 403f155

Please sign in to comment.