Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automate Binary Releases for Noname #173

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ronantakizawa
Copy link
Contributor

Automating Binary Releases for Noname by getting the latest version tag of Noname from CHANGELOG.md and building the binary release. Resolves issue #81

@katat
Copy link
Collaborator

katat commented Sep 2, 2024

Not quite sure of how this is going to work. Maybe a outline of the workflow is helpful :)

@ronantakizawa
Copy link
Contributor Author

ronantakizawa commented Sep 2, 2024

@katat

Key points

  • The workflow only proceeds with the release process if CHANGELOG.md has been updated.
  • The versioning is based on incrementing the patch number of the latest tag.
  • The binary is built and uploaded only if a new release is necessary.

  • Trigger: The workflow is triggered by a push to the main branch.

  • Steps:

    • Checkout Code:

      • Uses the actions/checkout@v2 to check out the latest code from the main branch.
    • Set Up Rust:

      • Uses the dtolnay/rust-toolchain@stable to set up the Rust environment with the stable toolchain.
    • Check for Changelog Changes:

      • Compares the CHANGELOG.md file between the latest tagged commit and the current commit.
      • If changes are found in CHANGELOG.md, it sets an output needs_release to true.
    • Generate New Version Tag:

      • If needs_release is true, it calculates the next patch version number based on the latest tag.
      • Sets the new version tag as an output.
    • Build the Project:

      • If needs_release is true, it runs cargo build --release to compile the Rust project in release mode.
    • Install GitHub CLI:

      • Installs the GitHub CLI (gh) if a release is needed.
    • Authenticate GitHub CLI:

      • Authenticates the GitHub CLI using a GitHub token from the repository's secrets.
    • Create Release:

      • Uses the GitHub CLI to create a new release with the generated version tag if a release is needed.
    • Upload Assets:

      • Uploads the built binary (noname) as an asset to the GitHub release.

@katat
Copy link
Collaborator

katat commented Sep 3, 2024

Ok, cool. I got a better idea of this works atm.
I think we need to agree on the rule of triggering the release build.

From what @ronantakizawa described above, the rule seems to rely on

  • whether the changelog is updated
  • simply pick the latest git tag version to build

The potential problem of this approach is it might not be able to correctly pick up the right version corresponding to the changelog. For example,

  • When there are multiple versions, but we only documented one of them to release in changelog, which is not necessary the latest version.
  • Sometimes, there is a need to simply update some wordings in the changelog, but not necessary meant to build a release for each doc update.

Given the changelog format pattern as the following:

# Changelog

## [Unrelease]
...

## [0.7.0] - yyyy-mm-dd
...

## [0.6.0] - yyyy-mm-dd
....

Maybe the rule can be:

  1. always parse for the latest version from the pattern [major.minor.fix] in the changelog
  2. compare it with the latest built version, and only build it if the newly parsed version not yet exists in the releases repository.

This way can ensure it build and release the version corresponding to the update to changelog.
cc @mimoo

@mimoo mimoo requested a review from katat October 23, 2024 15:28
@mimoo
Copy link
Contributor

mimoo commented Oct 23, 2024

what's the status here, can we merge this?

@katat
Copy link
Collaborator

katat commented Oct 24, 2024

Will need to do some tests to check if it aligns with the updated changelog.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants