-
Notifications
You must be signed in to change notification settings - Fork 455
157 lines (132 loc) · 4.59 KB
/
cli-release-prod.yml
File metadata and controls
157 lines (132 loc) · 4.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
name: CLI Release Prod
on:
workflow_dispatch:
inputs:
version_type:
description: 'Version bump type'
required: true
default: 'patch'
type: choice
options:
- patch
- minor
- major
concurrency:
group: cli-prod-release
cancel-in-progress: false
permissions:
contents: write
jobs:
prepare-and-commit-prod:
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 production version
id: bump_version
run: |
cd cli/release
# 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 }} --no-git-tag-version
NEW_VERSION=$(bun -e "console.log(require('./package.json').version)")
echo "New production 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 cli/release/package.json
git commit -m "Bump version to ${{ steps.bump_version.outputs.new_version }}"
git push
- name: Create and push production 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: cli/release/
build-prod-binaries:
needs: prepare-and-commit-prod
uses: ./.github/workflows/cli-release-build.yml
with:
binary-name: codebuff
new-version: ${{ needs.prepare-and-commit-prod.outputs.new_version }}
artifact-name: updated-package
checkout-ref: ${{ github.sha }}
env-overrides: '{"NEXT_PUBLIC_CB_ENVIRONMENT": "prod"}'
secrets: inherit
# Create GitHub release with all binaries
create-prod-release:
needs: [prepare-and-commit-prod, build-prod-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: cli/release/
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ needs.prepare-and-commit-prod.outputs.new_version }}
name: Release v${{ needs.prepare-and-commit-prod.outputs.new_version }}
prerelease: false
body: |
## Codebuff v${{ needs.prepare-and-commit-prod.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-prod-npm:
needs: [prepare-and-commit-prod, create-prod-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: cli/release/
- name: Set up Node.js for npm publishing
uses: actions/setup-node@v4
with:
node-version: 24
registry-url: https://registry.npmjs.org/
- name: Publish to npm
run: |
cd cli/release
npm publish --access public