|
| 1 | +name: FreeBuff Release |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + version_type: |
| 7 | + description: 'Version bump type' |
| 8 | + required: true |
| 9 | + default: 'patch' |
| 10 | + type: choice |
| 11 | + options: |
| 12 | + - patch |
| 13 | + - minor |
| 14 | + - major |
| 15 | + |
| 16 | +concurrency: |
| 17 | + group: freebuff-release |
| 18 | + cancel-in-progress: false |
| 19 | + |
| 20 | +permissions: |
| 21 | + contents: write |
| 22 | + |
| 23 | +jobs: |
| 24 | + prepare-and-commit: |
| 25 | + runs-on: ubuntu-latest |
| 26 | + outputs: |
| 27 | + new_version: ${{ steps.bump_version.outputs.new_version }} |
| 28 | + steps: |
| 29 | + - uses: actions/checkout@v4 |
| 30 | + with: |
| 31 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 32 | + |
| 33 | + - uses: ./.github/actions/setup-project |
| 34 | + |
| 35 | + - name: Calculate and update version |
| 36 | + id: bump_version |
| 37 | + run: | |
| 38 | + cd freebuff/cli/release |
| 39 | +
|
| 40 | + CURRENT_VERSION=$(bun -e "console.log(require('./package.json').version)") |
| 41 | + echo "Current version: $CURRENT_VERSION" |
| 42 | +
|
| 43 | + npm version ${{ inputs.version_type }} --no-git-tag-version |
| 44 | + NEW_VERSION=$(bun -e "console.log(require('./package.json').version)") |
| 45 | +
|
| 46 | + echo "New FreeBuff version: $NEW_VERSION" |
| 47 | + echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT |
| 48 | +
|
| 49 | + - name: Configure git |
| 50 | + run: | |
| 51 | + git config --global user.name "github-actions[bot]" |
| 52 | + git config --global user.email "github-actions[bot]@users.noreply.github.com" |
| 53 | +
|
| 54 | + - name: Commit and push version bump |
| 55 | + run: | |
| 56 | + git stash |
| 57 | + git pull --rebase origin main |
| 58 | + git stash pop |
| 59 | + git add freebuff/cli/release/package.json |
| 60 | + git commit -m "Bump FreeBuff version to ${{ steps.bump_version.outputs.new_version }}" |
| 61 | + git push |
| 62 | +
|
| 63 | + - name: Create and push tag |
| 64 | + run: | |
| 65 | + git tag "freebuff-v${{ steps.bump_version.outputs.new_version }}" |
| 66 | + git push origin "freebuff-v${{ steps.bump_version.outputs.new_version }}" |
| 67 | +
|
| 68 | + - name: Upload updated package |
| 69 | + uses: actions/upload-artifact@v4 |
| 70 | + with: |
| 71 | + name: freebuff-updated-package |
| 72 | + path: freebuff/cli/release/ |
| 73 | + |
| 74 | + build-binaries: |
| 75 | + needs: prepare-and-commit |
| 76 | + uses: ./.github/workflows/cli-release-build.yml |
| 77 | + with: |
| 78 | + binary-name: freebuff |
| 79 | + new-version: ${{ needs.prepare-and-commit.outputs.new_version }} |
| 80 | + artifact-name: freebuff-updated-package |
| 81 | + checkout-ref: ${{ github.sha }} |
| 82 | + env-overrides: '{"FREEBUFF_MODE": "true", "NEXT_PUBLIC_CB_ENVIRONMENT": "prod"}' |
| 83 | + secrets: inherit |
| 84 | + |
| 85 | + create-release: |
| 86 | + needs: [prepare-and-commit, build-binaries] |
| 87 | + runs-on: ubuntu-latest |
| 88 | + steps: |
| 89 | + - uses: actions/checkout@v4 |
| 90 | + |
| 91 | + - name: Download all binary artifacts |
| 92 | + uses: actions/download-artifact@v4 |
| 93 | + with: |
| 94 | + path: binaries/ |
| 95 | + |
| 96 | + - name: Download updated package |
| 97 | + uses: actions/download-artifact@v4 |
| 98 | + with: |
| 99 | + name: freebuff-updated-package |
| 100 | + path: freebuff/cli/release/ |
| 101 | + |
| 102 | + - name: Create GitHub Release |
| 103 | + uses: softprops/action-gh-release@v1 |
| 104 | + with: |
| 105 | + tag_name: freebuff-v${{ needs.prepare-and-commit.outputs.new_version }} |
| 106 | + name: FreeBuff v${{ needs.prepare-and-commit.outputs.new_version }} |
| 107 | + prerelease: false |
| 108 | + body: | |
| 109 | + ## FreeBuff v${{ needs.prepare-and-commit.outputs.new_version }} |
| 110 | +
|
| 111 | + Free AI coding assistant — binary releases for all supported platforms. |
| 112 | +
|
| 113 | + ### Installation |
| 114 | + ```bash |
| 115 | + npm install -g freebuff |
| 116 | + ``` |
| 117 | +
|
| 118 | + ### Platform Binaries |
| 119 | + - `freebuff-linux-x64.tar.gz` - Linux x64 |
| 120 | + - `freebuff-linux-arm64.tar.gz` - Linux ARM64 |
| 121 | + - `freebuff-darwin-x64.tar.gz` - macOS Intel |
| 122 | + - `freebuff-darwin-arm64.tar.gz` - macOS Apple Silicon |
| 123 | + - `freebuff-win32-x64.tar.gz` - Windows x64 |
| 124 | + files: | |
| 125 | + binaries/*/freebuff-* |
| 126 | + repository: CodebuffAI/codebuff-community |
| 127 | + token: ${{ secrets.CODEBUFF_GITHUB_TOKEN }} |
| 128 | + |
| 129 | + publish-npm: |
| 130 | + needs: [prepare-and-commit, create-release] |
| 131 | + runs-on: ubuntu-latest |
| 132 | + permissions: |
| 133 | + contents: read |
| 134 | + id-token: write |
| 135 | + steps: |
| 136 | + - uses: actions/checkout@v4 |
| 137 | + |
| 138 | + - name: Download updated package |
| 139 | + uses: actions/download-artifact@v4 |
| 140 | + with: |
| 141 | + name: freebuff-updated-package |
| 142 | + path: freebuff/cli/release/ |
| 143 | + |
| 144 | + - name: Set up Node.js for npm publishing |
| 145 | + uses: actions/setup-node@v4 |
| 146 | + with: |
| 147 | + node-version: 24 |
| 148 | + registry-url: https://registry.npmjs.org/ |
| 149 | + |
| 150 | + - name: Publish to npm |
| 151 | + run: | |
| 152 | + cd freebuff/cli/release |
| 153 | + npm publish --access public |
| 154 | + env: |
| 155 | + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
0 commit comments