@@ -27,29 +27,13 @@ jobs:
2727 token : ${{ secrets.GITHUB_TOKEN }}
2828 ref : ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
2929
30- - name : Set up Bun
31- uses : oven-sh/setup-bun@v2
32- with :
33- bun-version : ' 1.3.0'
34-
35- - name : Cache dependencies
36- uses : actions/cache@v4
37- with :
38- path : |
39- node_modules
40- */node_modules
41- key : ${{ runner.os }}-deps-${{ hashFiles('**/bun.lock*', '**/package.json') }}
42- restore-keys : |
43- ${{ runner.os }}-deps-${{ hashFiles('**/bun.lock*') }}
44- ${{ runner.os }}-deps-
45-
46- - name : Install dependencies
47- run : bun install --frozen-lockfile
30+ - uses : ./.github/actions/setup-project
4831
4932 - name : Calculate staging version
5033 id : bump_version
5134 env :
5235 GITHUB_TOKEN : ${{ secrets.CODEBUFF_GITHUB_TOKEN }}
36+ GITHUB_API_URL : https://api.github.com/repos/CodebuffAI/codebuff-community
5337 run : |
5438 cd cli/release-staging
5539
5842
5943 echo "Fetching latest CLI prerelease from GitHub..."
6044 RELEASES_JSON=$(curl -s -H "Authorization: token ${GITHUB_TOKEN}" \
61- "https://api.github.com/repos/CodebuffAI/codebuff /releases?per_page=100")
45+ "${GITHUB_API_URL} /releases?per_page=100")
6246
6347 LATEST_TAG=$(echo "$RELEASES_JSON" | jq -r '.[] | select(.prerelease == true and (.name // "" | test("Codebuff CLI v"))) | .tag_name' | sort -V | tail -n 1)
6448
@@ -152,12 +136,14 @@ jobs:
152136 ref : ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
153137
154138 - name : Clean up old CLI prereleases
139+ env :
140+ GITHUB_API_URL : https://api.github.com/repos/CodebuffAI/codebuff-community
155141 run : |
156142 ONE_WEEK_AGO=$(date -d '7 days ago' -u +%Y-%m-%dT%H:%M:%SZ)
157143 echo "Removing CLI prereleases older than: $ONE_WEEK_AGO"
158144
159145 RELEASES=$(curl -s -H "Authorization: token ${{ secrets.CODEBUFF_GITHUB_TOKEN }}" \
160- "https://api.github.com/repos/CodebuffAI/codebuff /releases?per_page=100")
146+ "${GITHUB_API_URL} /releases?per_page=100")
161147
162148 if echo "$RELEASES" | jq -e . >/dev/null 2>&1; then
163149 OLD=$(echo "$RELEASES" | jq -r '.[] | select(.prerelease == true and .created_at < "'$ONE_WEEK_AGO'" and (.tag_name | test("^v[0-9].*-beta\\.[0-9]+$"))) | "\(.id):\(.tag_name)"')
@@ -168,7 +154,7 @@ jobs:
168154 echo "$OLD" | while IFS=: read -r RELEASE_ID TAG_NAME; do
169155 curl -s -X DELETE \
170156 -H "Authorization: token ${{ secrets.CODEBUFF_GITHUB_TOKEN }}" \
171- "https://api.github.com/repos/CodebuffAI/codebuff /releases/$RELEASE_ID"
157+ "${GITHUB_API_URL} /releases/$RELEASE_ID"
172158 done
173159 else
174160 echo "No stale prereleases found."
@@ -192,6 +178,7 @@ jobs:
192178 - name : Create GitHub prerelease
193179 env :
194180 VERSION : ${{ needs.prepare-and-commit-staging.outputs.new_version }}
181+ GITHUB_API_URL : https://api.github.com/repos/CodebuffAI/codebuff
195182 run : |
196183 CURRENT_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
197184 RELEASE_BODY=$(cat <<'EOF'
@@ -214,7 +201,7 @@ jobs:
214201 -H "Accept: application/vnd.github.v3+json" \
215202 -H "Authorization: token ${{ secrets.CODEBUFF_GITHUB_TOKEN }}" \
216203 -H "Content-Type: application/json" \
217- https://api.github.com/repos/CodebuffAI/codebuff /releases \
204+ ${GITHUB_API_URL} /releases \
218205 -d "{
219206 \"tag_name\": \"v${VERSION}\",
220207 \"name\": \"Codecane v${VERSION} (Staging)\",
@@ -226,9 +213,11 @@ jobs:
226213 - name : Upload release assets
227214 env :
228215 VERSION : ${{ needs.prepare-and-commit-staging.outputs.new_version }}
216+ GITHUB_API_URL : https://api.github.com/repos/CodebuffAI/codebuff
217+ GITHUB_UPLOADS_URL : https://uploads.github.com/repos/CodebuffAI/codebuff
229218 run : |
230219 RELEASE_ID=$(curl -s -H "Authorization: token ${{ secrets.CODEBUFF_GITHUB_TOKEN }}" \
231- "https://api.github.com/repos/CodebuffAI/codebuff /releases/tags/v${VERSION}" | jq -r '.id')
220+ "${GITHUB_API_URL} /releases/tags/v${VERSION}" | jq -r '.id')
232221
233222 if [ -z "$RELEASE_ID" ] || [ "$RELEASE_ID" = "null" ]; then
234223 echo "Failed to resolve release ID for v${VERSION}"
@@ -243,12 +232,17 @@ jobs:
243232 -H "Authorization: token ${{ secrets.CODEBUFF_GITHUB_TOKEN }}" \
244233 -H "Content-Type: application/octet-stream" \
245234 --data-binary @"$file" \
246- "https://uploads.github.com/repos/CodebuffAI/codebuff /releases/$RELEASE_ID/assets?name=$FILENAME"
235+ "${GITHUB_UPLOADS_URL} /releases/$RELEASE_ID/assets?name=$FILENAME"
247236 fi
248237 done
249238
250239 publish-staging-npm :
251- needs : [prepare-and-commit-staging, build-staging-binaries, create-staging-release]
240+ needs :
241+ [
242+ prepare-and-commit-staging,
243+ build-staging-binaries,
244+ create-staging-release,
245+ ]
252246 runs-on : ubuntu-latest
253247 permissions :
254248 contents : read
0 commit comments