Skip to content

Manual Release

Manual Release #6

name: Manual Release
on:
workflow_dispatch:
inputs:
version:
description: Semantic version to release (e.g. 0.1.3)
required: true
npm-dist-tag:
description: Optional npm dist-tag (defaults to latest)
required: false
default: latest
jobs:
release:
runs-on: ubuntu-latest
env:
VERSION: ${{ github.event.inputs.version }}
TAG_NAME: v${{ github.event.inputs.version }}
DIST_TAG: ${{ github.event.inputs.npm-dist-tag }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure git user
run: |
git config user.name "codex-status-bot"
git config user.email "actions@users.noreply.github.com"
- name: Ensure tag does not already exist
run: |
if git rev-parse "$TAG_NAME" >/dev/null 2>&1; then
echo "::error ::Tag $TAG_NAME already exists. Bump the version." && exit 1
fi
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: npm install
- name: Update package version
run: npm version "$VERSION" --no-git-tag-version
- name: Commit version bump for clean working tree
run: |
if [[ -n "$(git status --short)" ]]; then
git add -A
git commit -m "chore: bump version to v$VERSION"
fi
- name: Run release preparation script
run: npm run release:prepare
- name: Remove generated dist artifacts
run: rm -rf dist
- name: Commit release preparation changes
run: |
if [[ -n "$(git status --short)" ]]; then
git add -A
git commit -m "chore: release v$VERSION"
else
echo "::error ::No changes detected after running release preparation." && exit 1
fi
- name: Create git tag
run: git tag "$TAG_NAME"
- name: Push changes and tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git push origin HEAD:main
git push origin "$TAG_NAME"
- name: Publish to npm
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
if [[ -z "$NODE_AUTH_TOKEN" ]]; then
echo "::error ::NPM_TOKEN secret is not configured." && exit 1
fi
npm publish --tag "$DIST_TAG"
- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.TAG_NAME }}
name: codex-status ${{ env.TAG_NAME }}
generate_release_notes: true
- name: Dispatch verify-homebrew event
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.repository }}
event-type: verify-homebrew
client-payload: '{"tag": "${{ env.TAG_NAME }}"}'