Adapt release workflow for workspace (#331)

Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Félix Saparelli 2022-09-04 23:12:10 +12:00 committed by GitHub
parent f5a682ccce
commit e21617cc9e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 33 additions and 20 deletions

View file

@ -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}"

View file

@ -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) { %>

View file

@ -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

View file

@ -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

10
Cargo.lock generated
View file

@ -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"

View file

@ -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"

View file

@ -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 <Jiahao_XU@outlook.com>"]
edition = "2021"

View file

@ -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 <felix@passcod.name>"]
edition = "2021"

View file

@ -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 <Jiahao_XU@outlook.com>"]
edition = "2021"

View file

@ -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 <ryan@kurte.nz>"]
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"

View file

@ -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 <Jiahao_XU@outlook.com>"]
edition = "2021"