Skip to content

Release

Release #116

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
version:
description: 'Specify the version'
required: false
type: string
dryRun:
description: 'Start the release with dryRun parameter'
required: true
type: boolean
default: true
jobs:
release:
strategy:
matrix:
node-version: [20]
if: (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/release') || (github.event_name == 'workflow_dispatch' && github.event.inputs.dryRun == 'true')
name: Release new version 🛠
runs-on: ubuntu-latest
permissions:
contents: write
actions: write
issues: write
pull-requests: write
id-token: write
steps:
- name: Check out the code 🗄
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Install dependencies
shell: bash
run: pnpm install --frozen-lockfile --prefer-offline
- name: Create new version 🛠
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
pnpm exec nx release ${{ github.event.inputs.version || '' }} --skip-publish --verbose --dryRun=${{ github.event.inputs.dryRun }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Sync main with release 📤
if: ${{ github.event.inputs.dryRun == 'false' }}
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git fetch origin
git switch main
git pull origin main
git merge origin/release --ff-only -m "chore: merge release into main" --no-verify
git push origin main
- name: Build code 🛠
run: pnpm lib:build
- name: Publish new version 🛠
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
pnpm exec nx release publish --verbose --dryRun=${{ github.event.inputs.dryRun }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: true