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 publish to crates.io #800

Merged
merged 1 commit into from
Oct 8, 2022
Merged

Automate publish to crates.io #800

merged 1 commit into from
Oct 8, 2022

Conversation

spenserblack
Copy link
Collaborator

This is pretty much just copied and pasted from here.

I thought we were doing this already, but a quick search on cs.github.com didn't turn anything up.

As it doesn't use the existing file from make build (cargo publish always rebuilds AFAIK), I
made this a separate job.

Comment on lines +66 to +85
cargo-publish:
name: Publish to crates.io
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: always

steps:
- uses: actions/checkout@v3

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
components: clippy

- name: Publish to crates.io
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo publish
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
cargo-publish:
name: Publish to crates.io
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
components: clippy
- name: Publish to crates.io
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo publish
- name: Publish to crates.io
if: matrix.os == 'ubuntu-latest'
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo publish

Why not just make it a step like the others?

Copy link
Collaborator Author

@spenserblack spenserblack Oct 8, 2022

Choose a reason for hiding this comment

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

If it's a separate job it can run in parallel without waiting on other steps or making other steps wait on it. But I'm not too attached to making it a separate job, so if you prefer it as a step then 👍 from me. I'll be happy either way 😃

Copy link
Owner

@o2sh o2sh left a comment

Choose a reason for hiding this comment

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

Thanks a lot @spenserblack
I'm also surprised we haven't thought about this before 😅

I created the action secret containing the crates.io API token. So we should be all set for the next release.

image

@o2sh o2sh merged commit 6eabbed into o2sh:main Oct 8, 2022
@spenserblack spenserblack deleted the cd/automate-cargo-publish branch December 26, 2022 19:27
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.

None yet

2 participants