Skip to content

Commit aaf67e4

Browse files
authored
Merge pull request #125 from MostroP2P/update-gh-actions
Aligned cargo release and gh actions to mostrod process
2 parents b57460e + ed3f13a commit aaf67e4

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

.github/workflows/rust.yml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,29 @@ jobs:
7070
- name: Build release
7171
run: cargo build --release
7272

73+
# Publish to crates.io (only if all builds succeed)
74+
# This job will only run if both test and build jobs succeed.
75+
publish:
76+
runs-on: ubuntu-latest
77+
needs: [test, build]
78+
if: success()
79+
permissions:
80+
contents: read
81+
steps:
82+
- uses: actions/checkout@v4
83+
- uses: dtolnay/rust-toolchain@stable
84+
- name: Cache cargo
85+
uses: Swatinem/rust-cache@v2
86+
with: { cache-on-failure: true }
87+
- name: Publish to crates.io
88+
run: cargo publish --locked
89+
env:
90+
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
91+
7392
# Create release
7493
release:
7594
runs-on: ubuntu-latest
76-
needs: [changelog, build]
95+
needs: [changelog, build, publish]
7796
permissions:
7897
contents: write
7998
steps:

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "mostro-core"
3-
version = "0.6.56"
3+
version = "0.6.57"
44
edition = "2021"
55
license = "MIT"
66
authors = ["Francisco Calderón <negrunch@grunch.dev>"]
@@ -13,7 +13,7 @@ crate-type = ["cdylib", "lib"]
1313

1414
[package.metadata.release]
1515
# (Default: true) Set to false to prevent automatically running `cargo publish`.
16-
publish = true
16+
publish = false
1717
# (Default: true) Set to false to prevent automatically pushing commits and tags to the Git remote.
1818
push = true
1919
# (Default: true) Run `cargo test` before release? Highly recommended.
@@ -30,7 +30,7 @@ allow-branch = ["main"]
3030
pre-release-hook = [
3131
"sh",
3232
"-c",
33-
"rm -f CHANGELOG.md && GITHUB_TOKEN=\"${GITHUB_TOKEN:-}\" git cliff --unreleased --github-repo MostroP2P/mostro-core -o CHANGELOG.md --tag {{version}} && if [ \"$DRY_RUN\" = \"true\" ]; then echo \"DRY RUN: Skip add/commit\"; else (git diff --quiet CHANGELOG.md || git add CHANGELOG.md && git commit -m \"Update CHANGELOG for version {{version}}\"); fi",
33+
"cargo fmt --all && cargo clippy --all-targets --all-features -- -D warnings && if [ -n \"${GITHUB_TOKEN:-}\" ]; then GITHUB_TOKEN=\"$GITHUB_TOKEN\" git cliff --unreleased --github-repo MostroP2P/mostro-core -o CHANGELOG.md --tag {{version}}; else git cliff --unreleased -o CHANGELOG.md --tag {{version}}; fi && if [ \"$DRY_RUN\" != \"true\" ]; then git diff --quiet CHANGELOG.md || { git add CHANGELOG.md && git commit -m \"Update CHANGELOG for version {{version}}\"; }; else echo \"DRY RUN: Skip git add and commit\"; fi",
3434
]
3535

3636
[dependencies]

0 commit comments

Comments
 (0)