Skip to content

ci: bump action versions (#140) #361

ci: bump action versions (#140)

ci: bump action versions (#140) #361

name: Test and Release
# Run this job on all pushes to main and for pull requests
on:
push:
branches:
# This avoids having duplicate builds in non-forked PRs
- "main"
pull_request: {}
# Cancel previous PR/branch runs when a new commit is pushed
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
# ===================
# Tests everything
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x] # This should be LTS
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- name: Install dependencies
run: yarn install --immutable
- name: Check TypeScript code
run: yarn check
- name: Run linter
run: yarn run lint
- name: Try to generate index file
run: yarn build:index
- name: Run component tests
run: yarn run test:ci
- name: Check file download/integrity of changed files
if: github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const script = require(`${process.env.GITHUB_WORKSPACE}/.github/scripts/check-integrity.cjs`);
return script({github, context, core});
# ===================
# Deploys successful builds on the main branch to Cloudflare
deploy:
if: |
github.event_name == 'push' &&
github.ref == 'refs/heads/main'
needs: [test]
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x] # This should be LTS
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- name: Install dependencies
run: yarn install --immutable
- name: Generate index file
run: yarn build:index
- name: Publish to Cloudflare
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
packageManager: yarn
- name: Upload config files to Cloudflare
env:
BASE_URL: ${{ secrets.BASE_URL }}
ADMIN_SECRET: ${{ secrets.ADMIN_SECRET }}
run: yarn upload