Skip to content

chore: Add ability to generate provenance statements #326

chore: Add ability to generate provenance statements

chore: Add ability to generate provenance statements #326

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.ref }}-node-${{ 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 is only necessary if you want to publish to Github
packages: write
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@85e6279cec87321a52edac9c87bce653a07cf6c2 # pin@main
- name: βŽ” Setup node ${{ matrix.node-version }}
uses: actions/setup-node@802632921f8532d2409ae6eac3313b6f81f11122 # 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 }}-node-${{ matrix.node-version }}-${{
hashFiles('**/package-lock.json') }}
- name: πŸ—„ Cache .eslintcache
uses: actions/cache@36f1e144e1c8edb0a652766b484448563d8baf46 # pin@main
with:
path: .eslintcache
key: eslintcache-${{ runner.os }}-node-${{ matrix.node-version }}-${{
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
CLOCKODO_USER: ${{ secrets.CLOCKODO_USER }}
CLOCKODO_API_KEY: ${{ secrets.CLOCKODO_API_KEY }}
- name: ⬆️ Upload coverage report
if: "matrix.node-version == '22.x'"
uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # pin@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
# - RELEASE ---------------------------------------------------------------------------------------
- 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