Return form submissions #18
Workflow file for this run
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
name: Build and deploy to Cloudflare Pages | |
on: push | |
jobs: | |
build-jekyll: | |
runs-on: ubuntu-22.04 | |
container: | |
image: ruby:3.3.1 | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Install gems | |
run: bundle install | |
- name: Build website | |
run: bundle exec jekyll build | |
env: | |
JEKYLL_ENV: production | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: jekyll-website | |
if-no-files-found: error | |
path: _site/ | |
validate-d1: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Create tables in local database beh-uk-forms | |
uses: cloudflare/wrangler-action@v3 | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
command: d1 execute beh-uk-forms --local --file=./sql/beh-uk-forms-schema.sql | |
deploy-to-cloudflare-pages: | |
needs: [build-jekyll, validate-d1] | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Extract branch name | |
shell: bash | |
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT | |
id: extract_branch | |
- name: Download built website | |
uses: actions/download-artifact@v4 | |
with: | |
name: jekyll-website | |
path: _site | |
- name: Copy functions | |
run: cp -r functions _site | |
- name: Copy functions sources / imports | |
run: cp -r functions-src _site | |
- name: Deploy to Cloudflare Pages | |
uses: cloudflare/wrangler-action@v3 | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
command: pages deploy _site --project-name=beh-uk --branch=${{ steps.extract_branch.outputs.branch }} --commit-dirty=true | |
deploy-d1: | |
needs: [build-jekyll, validate-d1] | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Deploy tables to remote database beh-uk-forms | |
uses: cloudflare/wrangler-action@v3 | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
command: d1 execute beh-uk-forms --file=./sql/beh-uk-forms-schema.sql |