Update cli binary workflow to push to releases#2204
Conversation
WalkthroughReplaces the previous Git commit/push steps in the CLI build workflow with a GitHub Release creation using ncipollo/release-action, tagging releases with cli-${{ github.sha }}, generating release notes, and attaching the built tar.gz artifact. Removes local git config and commit/push logic. Changes
Sequence Diagram(s)sequenceDiagram
actor Dev as Commit
participant GH as GitHub Actions
participant Build as Build CLI
participant Rel as ncipollo/release-action
participant GHRel as GitHub Releases
Dev->>GH: Push/PR triggers workflow
GH->>Build: Build CLI binary (tar.gz)
Build-->>GH: Artifact: crates/cli/bin/rain-orderbook-cli.tar.gz
GH->>Rel: Create prerelease with tag cli-${{ github.sha }}
Rel->>GHRel: Publish release + attach artifact
note over GH,Rel: Previous flow removed: git config, commit, and push of tarball
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/build-cli-binary.yaml(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Deploy-Docs-Preview
- GitHub Check: Deploy-Preview-Push
| - name: Create GitHub release | ||
| id: create_release | ||
| uses: ncipollo/release-action@v1 | ||
| env: | ||
| COMMIT_MESSAGE: "refresh orderbook cli" | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| git add crates/cli/bin/rain-orderbook-cli.tar.gz | ||
| if git diff --staged --quiet; then | ||
| echo "No changes to commit" | ||
| exit 0 | ||
| fi | ||
|
|
||
| git commit -m "$COMMIT_MESSAGE" | ||
| git push origin HEAD:${{ github.ref_name }} | ||
| with: | ||
| tag: cli-${{ github.sha }} | ||
| name: Rain Orderbook CLI ${{ github.sha }} | ||
| body: | | ||
| Rain Orderbook CLI binary built from commit ${{ github.sha }}. | ||
| prerelease: true | ||
| generateReleaseNotes: true | ||
| artifacts: crates/cli/bin/rain-orderbook-cli.tar.gz | ||
| artifactContentType: application/gzip |
There was a problem hiding this comment.
Allow updates so reruns don’t hard‑fail.
ncipollo/release-action defaults allowUpdates to false, so a rerun (same commit/tag) will error: “A release with tag cli-${{ github.sha }} already exists.” Set allowUpdates: true (and typically removeArtifacts: true) to make the workflow resumable.
Apply this diff:
with:
tag: cli-${{ github.sha }}
name: Rain Orderbook CLI ${{ github.sha }}
body: |
Rain Orderbook CLI binary built from commit ${{ github.sha }}.
prerelease: true
generateReleaseNotes: true
artifacts: crates/cli/bin/rain-orderbook-cli.tar.gz
artifactContentType: application/gzip
+ allowUpdates: true
+ removeArtifacts: true📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| - name: Create GitHub release | |
| id: create_release | |
| uses: ncipollo/release-action@v1 | |
| env: | |
| COMMIT_MESSAGE: "refresh orderbook cli" | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| git add crates/cli/bin/rain-orderbook-cli.tar.gz | |
| if git diff --staged --quiet; then | |
| echo "No changes to commit" | |
| exit 0 | |
| fi | |
| git commit -m "$COMMIT_MESSAGE" | |
| git push origin HEAD:${{ github.ref_name }} | |
| with: | |
| tag: cli-${{ github.sha }} | |
| name: Rain Orderbook CLI ${{ github.sha }} | |
| body: | | |
| Rain Orderbook CLI binary built from commit ${{ github.sha }}. | |
| prerelease: true | |
| generateReleaseNotes: true | |
| artifacts: crates/cli/bin/rain-orderbook-cli.tar.gz | |
| artifactContentType: application/gzip | |
| - name: Create GitHub release | |
| id: create_release | |
| uses: ncipollo/release-action@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag: cli-${{ github.sha }} | |
| name: Rain Orderbook CLI ${{ github.sha }} | |
| body: | | |
| Rain Orderbook CLI binary built from commit ${{ github.sha }}. | |
| prerelease: true | |
| generateReleaseNotes: true | |
| artifacts: crates/cli/bin/rain-orderbook-cli.tar.gz | |
| artifactContentType: application/gzip | |
| allowUpdates: true | |
| removeArtifacts: true |
🤖 Prompt for AI Agents
.github/workflows/build-cli-binary.yaml around lines 47 to 60: the release
action will fail on reruns because ncipollo/release-action defaults allowUpdates
to false; update the action inputs to set allowUpdates: true (and also set
removeArtifacts: true) so the workflow can resume on the same tag/artifacts
without hard-failing when a release already exists.
Motivation
See issue: #2190
Solution
Checks
By submitting this for review, I'm confirming I've done the following:
Summary by CodeRabbit
New Features
Chores