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

Add ci publish workflow #22

Merged
merged 30 commits into from
Nov 18, 2024
Merged

Conversation

ScottGibb
Copy link
Contributor

@ScottGibb ScottGibb commented Nov 7, 2024

Proposal for CI Publishing to crates.io

The following is a very simple solution to ticket #20. It does not involve any changes to the existing CI infrastructure.

How it Works

Whenever a new tag is made in the format VX.X.X, the release workflow will activate. It consists of two jobs.

  • check: Which is identical to the tests,yml. Ensuring that every release runs our ci tests
  • release: This job will only run if the check job passes, It will first verify that the Github tag matches the config.toml tag. Only then will it continue on with the build process and then publish both a GitHub Release and crates.io release. All tags should match each other, allowing a single source of truth to be found.

What Other options did I try

  • I tried to get the workflow to depend on the tests.yml workflow but couldn't find a good way of doing it.
  • I did look into automated PR publishing, however launching on tag means we can choose when we deliver a next release in a low effort fashion. It does rely that main is always tested and in a good stage, otherwise the release workflow will fail (on purpose) preventing a release to crates.io

Testing

@ScottGibb
Copy link
Contributor Author

ScottGibb commented Nov 7, 2024

The way in which ive orchestrated this release cycle is under the assumption: That not every PR into main will result in a crates.io release, but rather every tag in the format of vX.X.X on the main branch will result in a new crates.io/GitHub Release.

In its current stage in order to fully implement this Release workflow, The repo repository will need to have an API Secret key for CARGO_REGISTRY_TOKEN and if we want a staging key for testing releases CARGO_REGISTRIES_STAGING_TOKEN.

We will also need to adjust the Publish to crates.io stage to look more like this:

README.md Outdated Show resolved Hide resolved
.github/workflows/release.yml Show resolved Hide resolved
@ScottGibb ScottGibb marked this pull request as ready for review November 8, 2024 10:24
.github/workflows/release.yml Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
Cargo.toml Outdated Show resolved Hide resolved
.cargo/config.toml Outdated Show resolved Hide resolved
.github/workflows/release.yml Show resolved Hide resolved
@ScottGibb
Copy link
Contributor Author

If this is suitable to merge @lulf @alexmoon, Could you please squash the commits before merge? Due to the nature of how I tested this solution in GitHub, theres more commits than is really needed for a 1 file change :)

@alexmoon alexmoon merged commit 1edb422 into embassy-rs:main Nov 18, 2024
1 check passed
@alexmoon
Copy link
Collaborator

@lulf can you add the CARGO_REGISTRY_TOKEN secret to the github settings so this will work?

@lulf
Copy link
Member

lulf commented Nov 19, 2024

I actually don't have access to do that for bt-hci, @Dirbaio ^^

@Dirbaio
Copy link
Member

Dirbaio commented Nov 19, 2024

@lulf try now

@lulf
Copy link
Member

lulf commented Nov 19, 2024

@alexmoon Done

gibbz00 pushed a commit to ergin-org/bt-hci that referenced this pull request Jan 1, 2025
* Added initial workflow for publishing

* Adjusted trigger for testing purposes

* remove branch for testing

* adjusted format of release

* Reduced trigger criteria

* debugging commit

* Debugging the trigger

* removing if statement for CI passing

* release cycle verified and works

* Attempting to trigger it purely on tag based

* Added release

* workflow debugging

* Updated ReadMe and Added Release

* Updated dependencies

* Debugging

* commented out version handler

* Putting code back to state for Tagging and Release Management

* Updated if statement for checking if CI passed

* reset versioning number

* Changing order to check for tags first

* Latest changes on workflow

* adding staging release registry

* Added main check

* Making the code a bit clearer for publishing to crates.io

* Commented back in main registry push

* Removed staging registry

* Reverting back to old README

* Removed formatting change

* removed cargo.toml formatting

* removed staging registry environment variable
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.

5 participants