Skip to content

Release

Release #8

Workflow file for this run

# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
name: Release
on:
workflow_dispatch:
inputs:
version:
description: Release type
required: false
type: choice
default: patch
options:
- major
- minor
- patch
- premajor
- preminor
- prepatch
- prerelease
preid:
description: Pre-id
required: false
type: choice
options:
- ''
- dev
- alpha
- beta
- rc
jobs:
audit:
uses: ./.github/workflows/audit.yml
quality:
needs: audit
uses: ./.github/workflows/quality.yml
build:
needs: quality
uses: ./.github/workflows/build.yml
publish:
needs: build
runs-on: ubuntu-latest
name: Publish
permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the changed files back to the repository.
contents: write
steps:
- uses: actions/checkout@v4
- name: Setup Git
run: |
git config user.name "Cheese Grinder CI"
git config user.email "<>"
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org/
- name: Bump version
id: bump
uses: CheeseGrinder/[email protected]
with:
version: ${{ inputs.version }}
preid: ${{ inputs.preid }}
commiter-name: Cheese Grinder CI
- name: Publish
run: |
npm ci
npm run build --if-present
npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# Push only if the package as been published on registry
- name: Commit & Tag
run: |
git push
git tag ${{ steps.bump.outputs.version }}
git push origin tag ${{ steps.bump.outputs.version }}