Skip to content

Merge pull request #18 from solelychloe/main #64

Merge pull request #18 from solelychloe/main

Merge pull request #18 from solelychloe/main #64

Workflow file for this run

name: Build
on:
push:
pull_request:
repository_dispatch:
env:
NODE_VERSION: 16.x
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 60
# always run in pull request, or repository_dispatch
if: github.event_name == 'push' || github.event_name == 'pull_request' || github.event_name == 'repository_dispatch'
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Restore NPM cache
uses: actions/cache@v3
continue-on-error: true
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- run: npm ci
- run: npm test
deploy:
runs-on: ubuntu-latest
timeout-minutes: 60
needs: test
# only run if in main
if: github.ref == 'refs/heads/main' && (github.event_name == 'repository_dispatch' || github.event_name == 'push')
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Restore NPM cache
uses: actions/cache@v3
continue-on-error: true
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- run: npm ci
- name: Publish
# only publish if a direct `push`/`repository_dispatch`
uses: cloudflare/[email protected]
if: github.event_name == 'repository_dispatch' || github.event_name == 'push'
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
command: publish
secrets: |
AUTH_KEY
env:
NODE_ENV: production
AUTH_KEY: ${{ secrets.AUTH_KEY }}