Skip to content

Release 1.4.1 to NPM #30

Release 1.4.1 to NPM

Release 1.4.1 to NPM #30

Workflow file for this run

name: Release to NPM
run-name: 'Release ${{inputs.version}} to NPM'
on:
workflow_dispatch:
inputs:
version:
description: 'Version to be released'
required: true
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
registry-url: 'https://registry.npmjs.org'
cache: 'npm'
- name: Validate Version
run: |
PACKAGE_VERSION=$(node -p "require('./package.json').version")
INPUT_VERSION="${{ github.event.inputs.version }}"
if [ "$PACKAGE_VERSION" != "$INPUT_VERSION" ]; then
echo "Error: Version mismatch!"
echo "package.json contains: '$PACKAGE_VERSION'"
echo "Input version is: '$INPUT_VERSION'"
echo "Please update the package.json file to match the release version."
exit 1
fi
echo "Version validation passed: $INPUT_VERSION"
- name: Determine version metadata
id: version_metadata
run: |
VERSION="${{ github.event.inputs.version }}"
if [[ "$VERSION" == *"beta"* ]]; then
echo "is_beta=true" >> "$GITHUB_OUTPUT"
echo "dist_tag=beta" >> "$GITHUB_OUTPUT"
else
echo "is_beta=false" >> "$GITHUB_OUTPUT"
echo "dist_tag=latest" >> "$GITHUB_OUTPUT"
fi
- name: Install dependencies
run: npm ci
- name: Run Tests
run: npm run test
- name: Run Build
run: npm run prepare
- name: Read Changelog
id: read_changelog
if: ${{ steps.version_metadata.outputs.is_beta != 'true' }}
uses: mindsers/changelog-reader-action@v2
with:
version: ${{ github.event.inputs.version }}
- name: Create Release
if: steps.read_changelog.outputs.changes
uses: ncipollo/release-action@v1
with:
tag: ${{ github.event.inputs.version }}
name: ${{ github.event.inputs.version }}
body: ${{ steps.read_changelog.outputs.changes }}
allowUpdates: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: Release to npm
run: npm publish --provenance --access public --tag ${{ steps.version_metadata.outputs.dist_tag }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
generate-llms:
needs: release
uses: ./.github/workflows/generate-llms.yml
with:
llm_mode: changed
head: ${{ github.sha }}
secrets: inherit