-
Notifications
You must be signed in to change notification settings - Fork 285
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 publishing crates to crates.io #1364
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks mostly good. Could you use cargo publish -p PACKAGE-NAME
instead of setting the working directory? I know I suggested changing the working directories in 5085c5b, but I think using cargo publish -p PACKAGE-NAME
is slightly cleaner. As an added bonus one could just copy+paste the steps and run them from the project's root to publish manually if we avoid modifying the working directory.
Honestly when it comes to situations like this I think it's fine to basically test in production. In other words, just trigger the workflow when we're ready and expect it to work. If there's anything to fix we can make a new patch release to re-trigger the workflow. I've even seen big projects like Vue make new patches just to re-trigger a previously broken CD. Though of course we would never merge in a broken CD workflow 😉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, went through this again and had a few more comments.
.github/workflows/cd.yml
Outdated
CARGO_TERM_COLOR: always | ||
|
||
steps: | ||
- uses: actions/checkout@v3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- uses: actions/checkout@v3 | |
- uses: actions/checkout@v4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
.github/workflows/cd.yml
Outdated
env: | ||
CARGO_TERM_COLOR: always |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that this environment variable can actually be set on the workflow level (root level), not the job level. That way it will be set for all jobs, which should help on build steps for other jobs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’ll give it a try! This is how it was done in the “old” implementation, but that doesn’t make it optimal. Documentation supports your claim: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#env
.github/workflows/cd.yml
Outdated
- name: Install Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
profile: minimal | ||
components: clippy | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of actions-rs
is deprecated right now. TBH I'm wondering if we actually need a step to install Rust here. GitHub Actions have Rust and cargo
installed by default, and typically a pretty recent version AFAIK. I never bothered to explicitly install the Rust toolchain in some personal projects, and I've never had a problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. Looking more closely, the existing deploy
job has the following “Install Rust” step:
onefetch/.github/workflows/cd.yml
Lines 17 to 21 in ac7e2b8
- name: Install Rust | |
uses: dtolnay/rust-toolchain@v1 | |
with: | |
toolchain: stable | |
components: clippy |
I suppose it makes sense to either match that in cargo-publish
, or remove both “Install Rust” steps. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add dtolnay's action for consistency.
This mostly reverts commit 5085c5b. The goal is to restore `cargo-publish` automation, and fix handling of workspace crates in a follow-up commit.
Fixes o2sh#1363 by ensuring crates are published on a platform that fully supports symbolic links. Based on a suggestion in o2sh@5085c5b#commitcomment-91354413.
8e51c0f
to
477921c
Compare
I’ll follow up with this change next. |
I think I handled all the feedback except for #1364 (comment). Let me know what you think about #1364 (comment), and I’ll be back to this in a few hours. |
Great! Once you resolve #1364 (comment) this will be good to me. |
Done! Thank you for the thorough and helpful review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Congrats on getting some experience with GH Workflows!
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [o2sh/onefetch](https://github.com/o2sh/onefetch) | minor | `2.21.0` -> `2.22.0` | MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot). **Proposed changes to behavior should be submitted there as MRs.** --- ### Release Notes <details> <summary>o2sh/onefetch (o2sh/onefetch)</summary> ### [`v2.22.0`](https://github.com/o2sh/onefetch/blob/HEAD/CHANGELOG.md#2220-2024-09-20) [Compare Source](o2sh/onefetch@2.21.0...2.22.0) ##### New Features 🎉 - Add support for nerd font glyphs in languages info by [@​Localghost385](https://github.com/Localghost385) in o2sh/onefetch#1395 - \[onefetch.dev] Add nerdfont iconts to the preview by [@​Localghost385](https://github.com/Localghost385) in o2sh/onefetch#1411 - Automate publishing crates to crates.io by [@​musicinmybrain](https://github.com/musicinmybrain) in o2sh/onefetch#1364 ##### Bug Fixes 🐛 - Show future commit dates without panicking by [@​MalteT](https://github.com/MalteT) in o2sh/onefetch#1389 ##### Chores 🧹 - Re-generate the man page with --no-info by [@​musicinmybrain](https://github.com/musicinmybrain) in o2sh/onefetch#1376 - Drop unused shebangs from repo test fixture scripts by [@​musicinmybrain](https://github.com/musicinmybrain) in o2sh/onefetch#1375 ##### Commit Statistics <csr-read-only-do-not-edit/> - 3 commits contributed to the release. - 135 days passed between releases. - 0 commits were understood as [conventional](https://www.conventionalcommits.org). - 3 unique issues were worked on: [#​1389](o2sh/onefetch#1389), [#​1395](o2sh/onefetch#1395), [#​1404](o2sh/onefetch#1404) ##### Commit Details <csr-read-only-do-not-edit/> <details><summary>view details</summary> - **[#​1389](o2sh/onefetch#1389 - Show future commit dates without panicking ([`61ab298`](o2sh/onefetch@61ab298)) - **[#​1395](o2sh/onefetch#1395 - Add support for nerd font glyphs in languages info ([`6bf1807`](o2sh/onefetch@6bf1807)) - **[#​1404](o2sh/onefetch#1404 - Bump gix from 0.64.0 to 0.66.0 in the gix group ([`19f77b2`](o2sh/onefetch@19f77b2)) </details> </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this MR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40NDAuNyIsInVwZGF0ZWRJblZlciI6IjM3LjQ0MC43IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiXX0=-->
This mostly reverts 5085c5b, and attempts to support publishing workspace crates
onefetch-ascii
,onefetch-image
, andonefetch-manifest
. This would fix #1363 by ensuring crates are published on a platform that fully supports symbolic links.I have little to no experience with GitHub Workflows, and I am unable to test this PR, but it still seems like it should do the job.