Skip to content

Commit

Permalink
ci: release-please work
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Mar 16, 2024
1 parent 5a28172 commit 63de1d2
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 13 deletions.
33 changes: 31 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,44 @@ env:
jobs:
release-please:
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
steps:
- uses: google-github-actions/release-please-action@v4
id: release
with:
token: ${{ secrets.MY_RELEASE_PLEASE_TOKEN }}
release-type: simple
upload-assets:
prereleae: true
- uses: actions/checkout@v4
if: ${{ steps.release.outputs.release_created }}
with:
branch: release-please--branches--main
- name: update version string
if: ${{ steps.release.outputs.release_created }}
run: |
sed -i "s/^version = .*/version = \"${{ steps.release.outputs.tag_name }}\"/" Cargo.toml
git add Cargo.toml
git commit --amend --no-edit
git push -f
publish-crates:
needs: ["release-please"]
if: ${{ needs.release-please.steps.release.outputs.releases_created }}
if: ${{ needs.release-please.outputs.releases_created }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- name: Publish crates
run: |
cargo login ${{ secrets.CARGO_REGISTRY_TOKEN }}
cargo publish --manifest-path cli/Cargo.toml
upload-assets:
needs: ["publish-crates"]
strategy:
matrix:
include:
Expand Down
8 changes: 8 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,15 @@ members = [
]

[workspace.package]
version = "0.1.9"
homepage = "https://usage.jdx.dev"
documentation = "https://github.com/jdx/usage"
authors = ["Jeff Dickey @jdx"]
license = "MIT"

[workspace.dependencies]
usage-cli = { path = "cli" }
usage-lib = { path = "lib" }

[workspace.metadata.release]
allow-branch = ["main"]
16 changes: 10 additions & 6 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
name = "usage-cli"
edition = "2021"
repository = "https://github.com/jdx/usage"
version = "0.1.9"
description = "CLI for working with usage-based CLIs"
license.workspace = true
authors.workspace = true
documentation.workspace = true
homepage.workspace = true
version = { workspace = true }
license = { workspace = true }
authors = { workspace = true }
documentation = { workspace = true }
homepage = { workspace = true }
include = [
"/Cargo.toml",
"/Cargo.lock",
Expand Down Expand Up @@ -40,7 +40,7 @@ serde = { version = "1", features = ["derive"] }
strum = { version = "0.26", features = ["derive"] }
tera = "1"
thiserror = "1"
usage-lib = { path = "../lib", version = "0.1.9", features = ["clap"] }
usage-lib = { workspace = true }
xx = "0.2"

[dev-dependencies]
Expand All @@ -54,3 +54,7 @@ pkg-url = "{ repo }/releases/download/v{ version }/usage-{target}{ archive-suffi
pkg-url = "{ repo }/releases/download/v{ version }/usage-universal-apple-darwin{ archive-suffix }"
[package.metadata.binstall.overrides.x86_64-apple-darwin]
pkg-url = "{ repo }/releases/download/v{ version }/usage-universal-apple-darwin{ archive-suffix }"

[package.metadata.release]
shared-version = true
release = true
14 changes: 9 additions & 5 deletions lib/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[package]
name = "usage-lib"
edition = "2021"
version = "0.1.9"
rust-version = "1.70.0"
include = [
"/Cargo.toml",
Expand All @@ -10,10 +9,11 @@ include = [
"/src/**/*.rs",
]
description = "Library for working with usage specs"
homepage.workspace = true
documentation.workspace = true
authors.workspace = true
license.workspace = true
version = { workspace = true }
homepage = { workspace = true }
documentation = { workspace = true }
authors = { workspace = true }
license = { workspace = true }

[lib]
name = "usage"
Expand All @@ -39,3 +39,7 @@ default = ["clap"]
[dev-dependencies]
ctor = "0.2"
insta = "1"

[package.metadata.release]
shared-version = true
release = true

0 comments on commit 63de1d2

Please sign in to comment.