Skip to content

Release Legacy (NPM App) #2

Release Legacy (NPM App)

Release Legacy (NPM App) #2

name: Release Legacy (NPM App)
on:
workflow_dispatch:
inputs:
version_type:
description: 'Version bump type'
required: true
default: 'prepatch'
type: choice
options:
- prepatch
- minor
- major
permissions:
contents: write
jobs:
# First job: Prepare legacy release
prepare-and-commit-legacy:
runs-on: ubuntu-latest
outputs:
new_version: ${{ steps.bump_version.outputs.new_version }}
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: ./.github/actions/setup-project
- name: Calculate and update legacy version
id: bump_version
run: |
cd npm-app/release-legacy
# Get current version and bump it
CURRENT_VERSION=$(bun -e "console.log(require('./package.json').version)")
echo "Current version: $CURRENT_VERSION"
# Bump version based on input
npm version ${{ inputs.version_type }} --preid=legacy --no-git-tag-version
NEW_VERSION=$(bun -e "console.log(require('./package.json').version)")
echo "New legacy version: $NEW_VERSION"
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
- name: Configure git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Commit and push version bumpAdd commentMore actions
run: |
git stash
git pull --rebase origin main
git stash pop
git add npm-app/release-legacy/package.json
git commit -m "Bump version to ${{ steps.bump_version.outputs.new_version }}"
git push
- name: Create and push legacy tag
run: |
git tag "v${{ steps.bump_version.outputs.new_version }}"
git push origin "v${{ steps.bump_version.outputs.new_version }}"
- name: Upload updated package
uses: actions/upload-artifact@v4
with:
name: updated-package
path: npm-app/release-legacy/
build-legacy-binaries:
needs: prepare-and-commit-legacy
uses: ./.github/workflows/npm-app-release-build.yml
with:
binary-name: codebuff
new-version: ${{ needs.prepare-and-commit-legacy.outputs.new_version }}
artifact-name: updated-package
checkout-ref: ${{ github.sha }}
env-overrides: '{"NEXT_PUBLIC_CODEBUFF_BACKEND_URL": "manicode-backend.onrender.com", "NEXT_PUBLIC_CB_ENVIRONMENT": "prod"}'
secrets: inherit
# Create GitHub release with all binaries
create-legacy-release:
needs: [prepare-and-commit-legacy, build-legacy-binaries]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download all binary artifacts
uses: actions/download-artifact@v4
with:
path: binaries/
- name: Download updated package
uses: actions/download-artifact@v4
with:
name: updated-package
path: npm-app/release/
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ needs.prepare-and-commit-legacy.outputs.new_version }}
name: Release v${{ needs.prepare-and-commit-legacy.outputs.new_version }}
prerelease: false
body: |
## Codebuff v${{ needs.prepare-and-commit-legacy.outputs.new_version }}
Binary releases for all supported platforms.
### Installation
```bash
npm install -g codebuff
```
### Platform Binaries
- `codebuff-linux-x64.tar.gz` - Linux x64
- `codebuff-linux-arm64.tar.gz` - Linux ARM64
- `codebuff-darwin-x64.tar.gz` - macOS Intel
- `codebuff-darwin-arm64.tar.gz` - macOS Apple Silicon
- `codebuff-win32-x64.tar.gz` - Windows x64
files: |
binaries/*/codebuff-*
repository: CodebuffAI/codebuff-community
token: ${{ secrets.CODEBUFF_GITHUB_TOKEN }}
# Publish npm package
publish-legacy-npm:
needs: [prepare-and-commit-legacy, create-legacy-release]
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- name: Download updated package
uses: actions/download-artifact@v4
with:
name: updated-package
path: npm-app/release-legacy/
- name: Set up Node.js for npm publishing
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org/
- name: Publish to npm
run: |
cd npm-app/release-legacy
npm publish --access public --tag legacy
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}