Skip to content

ci: automate the release process adding npm provenance (#13) #33

ci: automate the release process adding npm provenance (#13)

ci: automate the release process adding npm provenance (#13) #33

Workflow file for this run

# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: CI
on:
push:
branches:
- main
pull_request:
jobs:
lint-test:
name: 🚀 Lint and test
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
matrix:
node: [ 18, 20 ]
steps:
- name: 👍 Checkout
uses: actions/checkout@v4
- name: 🐢 Setup node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'npm'
- name: 📥 Install dependencies
run: npm install
- name: 💅 Lint code style
run: npm run lint
- name: ✅ Run tests
run: npm run test
publish:
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
name: 📦 Publish
runs-on: ubuntu-latest
needs: lint-test
permissions:
# Needed by googleapis/release-please-action@v4
contents: write
pull-requests: write
# Needed by `npm publish --provenance`
id-token: write
steps:
- name: 🍄 Bump package version, create GitHub release, and update changelog
uses: googleapis/release-please-action@v4
id: release
- uses: actions/checkout@v4
if: ${{ steps.release.outputs.release_created }}
- uses: actions/setup-node@v4
if: ${{ steps.release.outputs.release_created }}
with:
node-version: lts/*
registry-url: https://registry.npmjs.org
- name: 🚀 Publish to npm
if: ${{ steps.release.outputs.release_created }}
run: |
npm install
npm run build --if-present
npm publish --provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}