diff --git a/.github/scripts/extract-tag-from-release-commit.sh b/.github/scripts/extract-tag-from-release-commit.sh index a9b11818..3e7d95bb 100755 --- a/.github/scripts/extract-tag-from-release-commit.sh +++ b/.github/scripts/extract-tag-from-release-commit.sh @@ -2,5 +2,7 @@ set -euxo pipefail message="$(head -n1 <<< "$COMMIT_MESSAGE")" -version="$(cut -d ' ' -f 2 <<< "${message}")" +crate="$(cut -d ' ' -f 2 <<< "${message}")" +version="$(cut -d ' ' -f 3 <<< "${message}")" +echo "::set-output name=crate::${crate}" echo "::set-output name=version::${version}" diff --git a/.github/scripts/release-pr-template.ejs b/.github/scripts/release-pr-template.ejs index 4cb6353c..40ad4438 100644 --- a/.github/scripts/release-pr-template.ejs +++ b/.github/scripts/release-pr-template.ejs @@ -29,7 +29,7 @@ You will still need to manually publish the cargo crate: ``` $ git pull $ git switch --detach v{version} -$ cargo publish +$ cargo publish -p <%= crate.name %> ``` <% if (pr.releaseNotes) { %> diff --git a/.github/workflows/release-pr.yml b/.github/workflows/release-pr.yml index 09eaf88a..7b70ce37 100644 --- a/.github/workflows/release-pr.yml +++ b/.github/workflows/release-pr.yml @@ -36,5 +36,5 @@ jobs: github-token: ${{ secrets.GITHUB_TOKEN }} version: ${{ inputs.version }} crate-path: crates/${{ inputs.crate }} - pr-release-notes: true + pr-release-notes: ${{ inputs.crate == 'bin' }} pr-template-file: .github/scripts/release-pr-template.ejs diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e467de94..c1ff2a44 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,9 +9,10 @@ on: jobs: info: runs-on: ubuntu-latest - # the commit message will look like: `release: v{version} (#{pr-number})` - if: "startsWith(github.event.head_commit.message, 'release: v')" + # the commit message will look like: `release: {crate-name} v{version} (#{pr-number})` + if: "startsWith(github.event.head_commit.message, 'release: ')" outputs: + crate: ${{ steps.version.outputs.crate }} version: ${{ steps.version.outputs.version }} notes: ${{ fromJSON(steps.notes.outputs.notes_json) }} env: @@ -33,7 +34,15 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Push release tag + - name: Push lib release tag + if: "! startsWith(github.event.head_commit.message, 'release: cargo-binstall v')" + uses: mathieudutour/github-tag-action@v6.0 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + custom_tag: ${{ needs.info.outputs.version }} + tag_prefix: ${{ needs.info.outputs.crate }}- + - name: Push cli release tag + if: "startsWith(github.event.head_commit.message, 'release: cargo-binstall v')" uses: mathieudutour/github-tag-action@v6.0 with: github_token: ${{ secrets.GITHUB_TOKEN }} @@ -41,12 +50,14 @@ jobs: tag_prefix: '' build: + if: "startsWith(github.event.head_commit.message, 'release: cargo-binstall v')" needs: info # not really, but just so it fails fast uses: ./.github/workflows/build.yml with: for_release: true release: + if: "startsWith(github.event.head_commit.message, 'release: cargo-binstall v')" needs: - info - tag diff --git a/Cargo.lock b/Cargo.lock index 313d3807..ef849824 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -77,7 +77,7 @@ checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" [[package]] name = "binstall" -version = "0.1.0" +version = "0.0.0" dependencies = [ "async-trait", "bytes", @@ -380,7 +380,7 @@ checksum = "3ee2393c4a91429dffb4bedf19f4d6abf27d8a732c8ce4980305d782e5426d57" [[package]] name = "detect-targets" -version = "0.1.0" +version = "0.0.0" dependencies = [ "cfg-if", "guess_host_triple", @@ -389,7 +389,7 @@ dependencies = [ [[package]] name = "detect-wasi" -version = "1.0.0" +version = "0.0.0" dependencies = [ "tempfile", ] @@ -532,7 +532,7 @@ dependencies = [ [[package]] name = "flock" -version = "0.1.0" +version = "0.0.0" dependencies = [ "fs4", ] @@ -1137,7 +1137,7 @@ dependencies = [ [[package]] name = "normalize-path" -version = "0.1.0" +version = "0.0.0" [[package]] name = "num-integer" diff --git a/crates/bin/Cargo.toml b/crates/bin/Cargo.toml index b2f65fc7..4401d01b 100644 --- a/crates/bin/Cargo.toml +++ b/crates/bin/Cargo.toml @@ -18,7 +18,7 @@ pkg-fmt = "zip" pkg-fmt = "zip" [dependencies] -binstall = { path = "../lib", version = "0.1.0" } +binstall = { path = "../lib", version = "0.0.0" } clap = { version = "3.2.17", features = ["derive"] } crates_io_api = { version = "0.8.0", default-features = false } dirs = "4.0.0" diff --git a/crates/detect-targets/Cargo.toml b/crates/detect-targets/Cargo.toml index e389b996..bd4ed72c 100644 --- a/crates/detect-targets/Cargo.toml +++ b/crates/detect-targets/Cargo.toml @@ -3,7 +3,7 @@ name = "detect-targets" description = "Detect the target of the env at runtime" repository = "https://github.com/cargo-bins/cargo-binstall" documentation = "https://docs.rs/detect-target" -version = "0.1.0" +version = "0.0.0" rust-version = "1.61.0" authors = ["Jiahao XU "] edition = "2021" diff --git a/crates/detect-wasi/Cargo.toml b/crates/detect-wasi/Cargo.toml index e9d4241c..851475ad 100644 --- a/crates/detect-wasi/Cargo.toml +++ b/crates/detect-wasi/Cargo.toml @@ -3,7 +3,7 @@ name = "detect-wasi" description = "Detect if WASI can be run" repository = "https://github.com/cargo-bins/cargo-binstall" documentation = "https://docs.rs/detect-wasi" -version = "1.0.0" +version = "0.0.0" rust-version = "1.61.0" authors = ["Félix Saparelli "] edition = "2021" diff --git a/crates/flock/Cargo.toml b/crates/flock/Cargo.toml index e9ce16b9..61461a48 100644 --- a/crates/flock/Cargo.toml +++ b/crates/flock/Cargo.toml @@ -3,7 +3,7 @@ name = "flock" description = "Locked files that can be used like normal File" repository = "https://github.com/cargo-bins/cargo-binstall" documentation = "https://docs.rs/flock" -version = "0.1.0" +version = "0.0.0" rust-version = "1.61.0" authors = ["Jiahao XU "] edition = "2021" diff --git a/crates/lib/Cargo.toml b/crates/lib/Cargo.toml index bcbb2353..b1f1c03c 100644 --- a/crates/lib/Cargo.toml +++ b/crates/lib/Cargo.toml @@ -3,7 +3,7 @@ name = "binstall" description = "Library backend for cargo-binstall" repository = "https://github.com/cargo-bins/cargo-binstall" documentation = "https://docs.rs/binstall" -version = "0.1.0" +version = "0.0.0" rust-version = "1.61.0" authors = ["ryan "] edition = "2021" @@ -17,10 +17,10 @@ cargo_toml = "0.11.5" clap = { version = "3.2.17", features = ["derive"] } compact_str = { version = "0.6.0", features = ["serde"] } crates_io_api = { version = "0.8.0", default-features = false } -detect-targets = { version = "0.1.0", path = "../detect-targets" } +detect-targets = { version = "0.0.0", path = "../detect-targets" } digest = "0.10.3" flate2 = { version = "1.0.24", default-features = false } -flock = { version = "0.1.0", path = "../flock" } +flock = { version = "0.0.0", path = "../flock" } futures-util = { version = "0.3.23", default-features = false, features = ["std"] } generic-array = "0.14.6" home = "0.5.3" @@ -28,7 +28,7 @@ itertools = "0.10.3" jobserver = "0.1.24" log = { version = "0.4.17", features = ["std"] } miette = "5.3.0" -normalize-path = { version = "0.1.0", path = "../normalize-path" } +normalize-path = { version = "0.0.0", path = "../normalize-path" } once_cell = "1.13.0" reqwest = { version = "0.11.11", features = ["stream"], default-features = false } scopeguard = "1.1.0" diff --git a/crates/normalize-path/Cargo.toml b/crates/normalize-path/Cargo.toml index d22ad55b..0a4ec09e 100644 --- a/crates/normalize-path/Cargo.toml +++ b/crates/normalize-path/Cargo.toml @@ -3,7 +3,7 @@ name = "normalize-path" description = "Like canonicalize, but without performing I/O" repository = "https://github.com/cargo-bins/cargo-binstall" documentation = "https://docs.rs/normalize-path" -version = "0.1.0" +version = "0.0.0" rust-version = "1.61.0" authors = ["Jiahao XU "] edition = "2021"