Skip to content

Release beta

Release beta #39

name: 🧪 Test and 🚀 Release
on:
push:
branches:
- main
- beta
pull_request: {}
workflow_dispatch: {}
jobs:
test-and-release:
runs-on: ubuntu-latest
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
strategy:
matrix:
node-version: [22.x]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.node-version }}
cancel-in-progress: true
permissions:
# Necessary for semantic-release
contents: write
issues: write
pull-requests: write
# Necessary for npm publish --provenance
# See https://docs.npmjs.com/generating-provenance-statements#example-github-actions-workflow
id-token: write
packages: write
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@85e6279cec87321a52edac9c87bce653a07cf6c2 # pin@main
- name: ⎔ Setup node
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # pin@main
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- name: 🗄 Cache node_modules
id: cache-node_modules
uses: actions/cache@36f1e144e1c8edb0a652766b484448563d8baf46 # pin@main
with:
path: "**/node_modules"
key: node_modules-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
- name: 📥 Install dependencies
if: steps.cache-node_modules.outputs.cache-hit != 'true'
run: |
npm ci --ignore-scripts
- name: 🧪 Test
run: |
npm test
env:
CI: true
- name: 🚀 Release on npm
if: ${{ contains(' refs/heads/main refs/heads/beta ', github.ref) && matrix.node-version == '22.x' }}
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npm run release