Skip to content

feat: github release bot - #100

Open
lirenjie95 wants to merge 3 commits into
masterfrom
feat/releaseBot
Open

lirenjie95 wants to merge 3 commits into
masterfrom
feat/releaseBot

Conversation

@lirenjie95

@lirenjie95 lirenjie95 commented Jul 27, 2025

Copy link
Copy Markdown
Collaborator

Fixes #98

Automated Release Workflow:

  • .github/workflows/release.yml: Added a GitHub Actions workflow to handle automated releases triggered by version tags or manual dispatch. The workflow includes steps for building multi-platform artifacts, generating changelogs, publishing to crates.io, and uploading release assets.

Documentation Updates:

  • RELEASE.md: Added a comprehensive guide detailing the release process, including setup instructions, versioning conventions, and step-by-step workflows for automated and manual releases.

Version Management:

  • scripts/update-version.sh: Added a script to update version numbers in Cargo.toml files and synchronize dependencies across the workspace. The script supports both Go-style (v1.2.3) and Rust-style (1.2.3) version formats.

@lirenjie95
lirenjie95 marked this pull request as draft July 27, 2025 02:13
@lirenjie95
lirenjie95 requested a review from Copilot July 27, 2025 02:14

This comment was marked as outdated.

@lirenjie95
lirenjie95 requested a review from Copilot July 27, 2025 02:25

This comment was marked as outdated.

lirenjie95 added a commit that referenced this pull request Jul 27, 2025
- Improve cargo publish error handling with proper logging
- Fix sed path separator consistency in update-version.sh
- Add reusable check_and_copy function for file operations
- Keep sccache-action@v0.0.9 (verified as latest version)
@lirenjie95
lirenjie95 requested a review from Copilot July 27, 2025 02:30

This comment was marked as outdated.

@lirenjie95
lirenjie95 requested a review from Copilot July 27, 2025 02:38

This comment was marked as outdated.

@lirenjie95
lirenjie95 marked this pull request as ready for review July 27, 2025 03:42
@lirenjie95 lirenjie95 added the github_actions Pull requests that update GitHub Actions code label Jul 27, 2025

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces an automated release system for the Rust2Go project, supporting both Go and Rust ecosystems with unified version management using Go-style versioning (v1.2.3) as the primary format.

  • Adds GitHub Actions workflow for automated releases triggered by version tags or manual dispatch
  • Provides comprehensive documentation for the release process including setup and workflow instructions
  • Implements a shell script for updating version numbers across the workspace with support for both Go and Rust version formats

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
.github/workflows/release.yml GitHub Actions workflow for automated releases with multi-platform builds, changelog generation, and publishing to crates.io
RELEASE.md Comprehensive documentation covering release processes, version management, and troubleshooting
scripts/update-version.sh Shell script for updating version numbers in Cargo.toml files and synchronizing workspace dependencies
Comments suppressed due to low confidence (1)

Comment thread scripts/update-version.sh
Comment thread scripts/update-version.sh Outdated
Comment thread .github/workflows/release.yml Outdated
Comment thread .github/workflows/release.yml
Comment thread .github/workflows/release.yml Outdated
Comment thread .github/workflows/release.yml
Comment thread .github/workflows/release.yml
Comment thread .github/workflows/release.yml
Comment thread .github/workflows/release.yml
Comment thread scripts/update-version.sh
@lirenjie95
lirenjie95 force-pushed the feat/releaseBot branch 2 times, most recently from 2d92732 to 0389f0a Compare May 9, 2026 12:51
@lirenjie95

Copy link
Copy Markdown
Collaborator Author

Hi @ihciah @suikammd,

I've rebased onto latest master, resolved the CI failures, and fixed several issues found during review. Here's a summary:


🔧 Fixes Applied

1. .github/workflows/release.yml

Issue Fix
Missing workflow permissions Added permissions: contents: write at workflow level. Without this, if the repo's default Actions permission is "Read-only", `actio
n-gh-release` will fail to create releases.
Windows target unreliable Changed x86_64-pc-windows-gnux86_64-pc-windows-msvc. GitHub windows-latest runners have MSVC toolchain by default; GNU requires
manual MinGW installation which is fragile.
sccache version inconsistent Upgraded v0.0.9v0.0.10 to match the repo's CI workflow.
Duplicate build steps Removed redundant cargo build --release --target (whole workspace) before cargo build -p rust2go-cli. The CLI binary is what we actually
ship.
Wrong crate publish order Moved mem-ring before rust2go-mem-ffi in publish sequence, since rust2go-mem-ffi depends on mem-ring.

2. scripts/update-version.sh

Issue Fix
Incomplete dependency mapping Added missing internal deps: rust2go-macrorust2go-common, rust2go-clirust2go-common, rust2go-mem-ffimem-ring + `rust2
go-convert`. Without these, running the script would leave some path dependency versions stale.
Overly aggressive cargo update Changed to cargo update --workspace to avoid bumping external crates.io dependencies unexpectedly.

🔑 About Secrets Configuration

There's a common misconception here — let me clarify what actually needs to be done:

GITHUB_TOKEN — No manual secret needed ✅

secrets.GITHUB_TOKEN is automatically injected by GitHub Actions on every run. You do not need to create it in Settings > Secrets.

What you DO need to check:

  • Go to Settings > Actions > General > Workflow permissions
  • Ensure it's set to "Read and write permissions" (not "Read repository contents and packages permissions only")
  • If restricted, the release job will fail with a permission denied error when trying to create the GitHub Release

CARGO_REGISTRY_TOKEN — Must be configured once ⚠️

This is the only secret that requires manual setup:

  1. Visit https://crates.io/me → generate an API token
  2. Go to Settings > Secrets and variables > Actions > New repository secret
  3. Name: CARGO_REGISTRY_TOKEN, Value: your crates.io token

Why this matters: Without this token, the release workflow will:

  • ✅ Successfully create GitHub Release with binaries
  • Fail to publish to crates.io, leaving Rust users unable to cargo add rust2go@0.4.2

This is a one-time setup for permanent automated releases. After configuring, every future release is just:

git tag v0.5.0 && git push origin master --tags
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
✅ Current Status
• cargo build — passing
• cargo clippy --all-features --all-targets -- --deny warnings — passing
• PR mergeable state: clean
Ready for final review!

@lirenjie95

Copy link
Copy Markdown
Collaborator Author

security issue found (via @ihciah)
https://blog.ammaraskar.com/github-token-stealing/

- Add release workflow (tag-driven): unify Go/Rust versions via
  scripts/update-version.sh, build CLI binaries for all platforms,
  create GitHub release, and publish crates to crates.io in dependency
  order with crates.io index-visibility waits between publishes.
- Add RELEASE.md documenting the release process.
- scripts/update-version.sh: bash 3.2 compatible; only rewrites the
  version string of path deps; syncs Cargo.lock via cargo metadata.

Tree state matches the reviewed merge 36f9c37; Cargo.toml/Cargo.lock
versions stay as on master (unified at release time).
@codecov-commenter

codecov-commenter commented Aug 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.74%. Comparing base (f2bb1b9) to head (f80ddb8).
⚠️ Report is 5 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master     #100       +/-   ##
===========================================
+ Coverage   83.52%   93.74%   +10.21%     
===========================================
  Files          18       18               
  Lines        3672     3818      +146     
===========================================
+ Hits         3067     3579      +512     
+ Misses        605      239      -366     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

- Package the Windows artifact with the system bsdtar (absolute path)
  instead of the unavailable zip binary; Git Bash shadows bsdtar with
  GNU tar, which cannot write zip archives.
- Make crates.io publishing re-runnable: tolerate the already-uploaded
  error per crate and keep failing fast on real errors.
- Pick the changelog base tag per trigger: newest existing tag on
  workflow_dispatch, second-newest on tag push.
- Narrow permissions: default contents:read, contents:write only for
  the jobs that create/upload the GitHub release.
- RELEASE.md: list x86_64-pc-windows-msvc to match the build matrix.
- Validate the version format in get_version and fail fast on typos.
- Changelog base: pick the newest stable tag excluding the released
  version (unifies tag push, dispatch, and re-release); tolerate empty
  results under pipefail so the root-commit fallback stays reachable.
- Drop the unneeded setup-go step from the build job.
- Copy README and licenses into the payload before archiving so the
  published packages include them.
- Add trailing newlines and trim trailing spaces.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

github_actions Pull requests that update GitHub Actions code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tag releases

3 participants