chore: bump dependencies #156
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 | |
on: | |
push: | |
pull_request: | |
repository_dispatch: | |
env: | |
NODE_VERSION: 20.x | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
# always run in pull request, or repository_dispatch. Otherwise (push, etc.) don't run if commit message is skipping CI | |
if: github.event_name == 'pull_request' || github.event_name == 'repository_dispatch' || (!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')) | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
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 run lint | |
- run: npm run check-types | |
- run: npm run test | |
deploy: | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
needs: test | |
# only run if in main. If repository_dispatch always run, else if `schedule` or `push`, only run if not skipping CI | |
if: github.ref == 'refs/heads/main' && (github.event_name == 'repository_dispatch' || (github.event_name == 'schedule' || github.event_name == 'push') && (!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]'))) | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
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 | |
uses: cloudflare/[email protected] | |
# only publish if a direct `push`/`repository_dispatch` | |
# publish non-production deploy if it's a fork | |
if: github.event_name == 'repository_dispatch' || github.event_name == 'push' && github.repository_owner != 'Cherry' | |
with: | |
apiToken: ${{ secrets.CF_API_TOKEN }} | |
accountId: ${{ secrets.CF_ACCOUNT_ID }} | |
command: "deploy" | |
- name: Publish (production) | |
uses: cloudflare/[email protected] | |
# only publish if a direct `push`/`repository_dispatch` | |
# publish production deploy if it's the original repository | |
if: (github.event_name == 'repository_dispatch' || github.event_name == 'push') && github.repository_owner == 'Cherry' | |
with: | |
apiToken: ${{ secrets.CF_API_TOKEN }} | |
accountId: ${{ secrets.CF_ACCOUNT_ID }} | |
command: "deploy --env=production" | |