Pull form submissions #22
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: Pull form submissions | |
permissions: | |
contents: write | |
on: | |
workflow_dispatch: | |
push: | |
branches: ["main"] | |
jobs: | |
build: | |
environment: github-pages | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [20.x] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/checkout@v4 | |
with: | |
repository: "NMSUD/Form" | |
path: nmsud-form | |
ref: main | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: "npm" | |
cache-dependency-path: nmsud-form/package-lock.json | |
- name: Setup Secrets | |
env: | |
XATA_API_KEY: ${{ secrets.XATA_API_KEY }} | |
XATA_DB_URL: ${{ secrets.XATA_DB_URL }} | |
XATA_FALLBACK_BRANCH: ${{ secrets.XATA_FALLBACK_BRANCH }} | |
NMSUD_IMG_BASE_URL: ${{ secrets.NMSUD_IMG_BASE_URL }} | |
run: | | |
cd nmsud-form | |
touch .env | |
echo XATA_API_KEY="$XATA_API_KEY" >> .env | |
echo XATA_DB_URL="$XATA_DB_URL" >> .env | |
echo XATA_FALLBACK_BRANCH="$XATA_FALLBACK_BRANCH" >> .env | |
echo NMSUD_IMG_BASE_URL="$NMSUD_IMG_BASE_URL" >> .env | |
- name: Pull data from Form Submissions | |
run: | | |
cd nmsud-form | |
npm ci | |
npm run data:downloader | |
cp -r data ../data | |
- name: Build Index.html | |
run: | | |
echo "" > .gitignore | |
npm run build | |
- name: Add .nojekyll | |
run: | | |
cd data | |
touch .nojekyll | |
- uses: JamesIves/github-pages-deploy-action@v4 | |
name: Deploy to GitHub Pages | |
if: github.event_name != 'pull_request' | |
with: | |
folder: data | |
clean: false |