Skip to content

chore: bump version to 2.4.0 #5

chore: bump version to 2.4.0

chore: bump version to 2.4.0 #5

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- run: npm ci
- run: npm run build
- run: npm test
- name: Verify version consistency
run: |
PKG_VERSION=$(node -p "require('./package.json').version")
TAG_VERSION="${GITHUB_REF_NAME#v}"
INDEX_VERSION=$(node -p "require('./dist/index.js').VERSION")
echo "package.json: $PKG_VERSION"
echo "git tag: $TAG_VERSION"
echo "index.ts: $INDEX_VERSION"
if [ "$PKG_VERSION" != "$TAG_VERSION" ]; then
echo "ERROR: package.json ($PKG_VERSION) != tag ($TAG_VERSION)"
exit 1
fi
if [ "$PKG_VERSION" != "$INDEX_VERSION" ]; then
echo "ERROR: package.json ($PKG_VERSION) != index.ts ($INDEX_VERSION)"
exit 1
fi
echo "All versions match: $PKG_VERSION"
publish-npm:
needs: validate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- run: npm run build
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
github-release:
needs: validate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Extract changelog for this version
id: changelog
run: |
VERSION="${GITHUB_REF_NAME#v}"
# Extract the section for this version from CHANGELOG.md
BODY=$(awk "/^## \[${VERSION}\]/{flag=1; next} /^## \[/{flag=0} flag" CHANGELOG.md)
echo "body<<EOF" >> "$GITHUB_OUTPUT"
echo "$BODY" >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
- uses: softprops/action-gh-release@v2
with:
body: ${{ steps.changelog.outputs.body }}
generate_release_notes: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
smoke-test:
needs: publish-npm
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Wait for npm propagation
run: sleep 30
- name: Install from npm and verify
run: |
TAG_VERSION="${GITHUB_REF_NAME#v}"
npm install -g "codebot-ai@${TAG_VERSION}"
INSTALLED=$(codebot --version 2>/dev/null || node -e "console.log(require('codebot-ai').VERSION)")
echo "Installed version: $INSTALLED"
if [ "$INSTALLED" != "$TAG_VERSION" ]; then
echo "WARNING: installed version mismatch (may need more propagation time)"
fi