Skip to content

Release

Release #16

Workflow file for this run

name: Release
on:
workflow_run:
workflows: ["Test"]
types:
- completed
branches:
- main
workflow_dispatch:
inputs:
dryRun:
description: "Do a dry run to preview instead of a real release"
required: true
default: "true"
jobs:
authorize:
name: Authorize
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch'
steps:
- name: ${{ github.actor }} permission check to do a release
uses: octokit/[email protected]
with:
route: GET /repos/:repository/collaborators/${{ github.actor }}
repository: ${{ github.repository }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release:
name: Release
runs-on: ubuntu-latest
needs: [authorize]
if: |
always() &&
(needs.authorize.result == 'success' || needs.authorize.result == 'skipped') &&
(github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success')
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- name: Install dependencies
run: npm ci
- name: Release --dry-run # Uses release.config.js
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.dryRun == 'true'}}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release --dry-run
- name: Release # Uses release.config.js
if: ${{ github.event_name == 'workflow_run' || (github.event_name == 'workflow_dispatch' && github.event.inputs.dryRun == 'false')}}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release