Skip to content

Commit ef45441

Browse files
authored
Release luwen to crates.io in CI (#153)
2 parents a0d2ec3 + 3bf8142 commit ef45441

File tree

21 files changed

+62
-59
lines changed

21 files changed

+62
-59
lines changed

.github/workflows/release.yml

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,22 +89,28 @@ jobs:
8989
run: git config --global user.email "${EMAIL}"
9090
- name: Git name
9191
run: git config --global user.name "${NAME}"
92-
- name: Install cargo-workspaces
93-
run: cargo install cargo-workspaces@0.3.6 --locked
92+
- name: Install cargo-edit
93+
run: cargo install cargo-edit@0.13.9 --locked
9494
- name: What version are we?
9595
id: luwenver
9696
run: |
9797
export luwen_ver="$( cargo metadata --format-version 1 | jq '.packages[] | select( .name =="luwen" ) | .version' | sed 's/"//g' )"
9898
echo "luwen_version=${luwen_ver}"
9999
echo "luwen_version=${luwen_ver}" >> "$GITHUB_OUTPUT"
100100
- name: Bump the version
101-
run: cargo ws version ${{ github.event.inputs.version_bump_type }} --allow-branch ${{ needs.tempbranch.outputs.rc_ref }} --no-git-tag --message "Cargo Release %v" -y
101+
run: cargo set-version --package=luwen --bump=${{ github.event.inputs.version_bump_type }}
102102
- name: What NEW Version?
103103
id: new-luwen-version
104104
run: |
105105
export luwen_version_new="$( cargo metadata --format-version 1 | jq '.packages[] | select( .name =="luwen" ) | .version' | sed 's/"//g' )"
106106
echo "luwen_version_new=${luwen_version_new}"
107107
echo "luwen_version_new=${luwen_version_new}" >> "$GITHUB_OUTPUT"
108+
- name: Commit version bump
109+
run: |
110+
git add .
111+
git commit -m "Cargo Release ${{ steps.new-luwen-version.outputs.luwen_version_new }}"
112+
git pull --rebase
113+
git push
108114
- name: Parse version from string
109115
id: version
110116
uses: release-kit/semver@v2
@@ -390,6 +396,31 @@ jobs:
390396
verbose: true
391397
skip-existing: true
392398

399+
###
400+
# Publish to crates.io
401+
###
402+
publish-crates-io:
403+
name: Publish Rust package
404+
needs:
405+
- changelogs
406+
- tagrelease
407+
runs-on: ubuntu-latest
408+
permissions:
409+
id-token: write
410+
steps:
411+
- uses: actions/checkout@v4
412+
with:
413+
ref: ${{ needs.changelogs.outputs.git_hash }}
414+
fetch-tags: true
415+
fetch-depth: 0
416+
- name: Authenticate with crates.io
417+
uses: rust-lang/crates-io-auth-action@v1
418+
id: auth
419+
- name: Publish crates
420+
run: cargo publish --workspace
421+
env:
422+
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
423+
393424
###
394425
# Publish PyPi
395426
###

Cargo.toml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ license = { workspace = true }
1313

1414
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1515

16-
[package.metadata.workspaces]
17-
independent = true
18-
1916
[dependencies]
2017
luwen-api = { workspace = true }
2118
luwen-def = { workspace = true }
@@ -61,11 +58,11 @@ license = "Apache-2.0"
6158
bincode = "1.3.3"
6259
bitfield-struct = "0.6.0"
6360
clap = { version = "4.4.14", features = ["derive"] }
64-
luwen = { path = "." }
65-
luwen-api = { path = "crates/luwen-api" }
66-
luwen-def = { path = "crates/luwen-def" }
67-
luwen-kmd = { path = "crates/luwen-kmd" }
68-
luwen-pci = { path = "crates/luwen-pci" }
61+
luwen = { path = ".", version = "0.8.1" }
62+
luwen-api = { path = "crates/luwen-api", version = "0.8.1" }
63+
luwen-def = { path = "crates/luwen-def", version = "0.8.1" }
64+
luwen-kmd = { path = "crates/luwen-kmd", version = "0.8.1" }
65+
luwen-pci = { path = "crates/luwen-pci", version = "0.8.1" }
6966
serde = { "version" = "1.0.185", features = ["derive"] }
7067
serde_json = "1.0.117"
7168
thiserror = "1.0.40"

apps/check-harvesting/Cargo.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@
22
name = "check-harvesting"
33
version = "0.1.1"
44
edition = { workspace = true }
5+
publish = false
56

67
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
78

8-
[package.metadata.workspaces]
9-
independent = true
10-
119
[dependencies]
1210
luwen = { workspace = true }

apps/create-ethernet-map/Cargo.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@
22
name = "create-ethernet-map"
33
version = "0.1.2"
44
edition = { workspace = true }
5+
publish = false
56

67
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
78

8-
[package.metadata.workspaces]
9-
independent = true
10-
119
[lib]
1210
crate-type = ["staticlib", "rlib"]
1311

apps/decode-boot-fs/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
name = "decode-boot-fs"
33
version = "0.1.0"
44
edition = { workspace = true }
5+
publish = false
56

6-
[package.metadata.workspaces]
7-
independent = true
7+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
88

99
[dependencies]
1010
clap = { workspace = true }

apps/drunken-monkey/Cargo.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@
22
name = "drunken-monkey"
33
version = "0.1.1"
44
edition = { workspace = true }
5+
publish = false
56

67
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
78

8-
[package.metadata.workspaces]
9-
independent = true
10-
119
[dependencies]
1210
clap = { workspace = true }
1311
luwen = { workspace = true }

apps/dump-flash/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
name = "dump-flash"
33
version = "0.1.0"
44
edition = { workspace = true }
5+
publish = false
56

6-
[package.metadata.workspaces]
7-
independent = true
7+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
88

99
[dependencies]
1010
luwen = { workspace = true }

apps/ethernet-benchmark/Cargo.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@
22
name = "ethernet-benchmark"
33
version = "0.1.2"
44
edition = { workspace = true }
5+
publish = false
56

67
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
78

8-
[package.metadata.workspaces]
9-
independent = true
10-
119
[dependencies]
1210
luwen = { workspace = true }
1311
rand = "0.8.5"

apps/flash_glx_revc_board_id/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
name = "flash_glx_revc_board_id"
33
version = "0.1.0"
44
edition = { workspace = true }
5+
publish = false
56

6-
[package.metadata.workspaces]
7-
independent = true
7+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
88

99
[dependencies]
1010
clap = { workspace = true }

apps/generate-names/Cargo.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@
22
name = "generate-names"
33
version = "0.1.2"
44
edition = { workspace = true }
5+
publish = false
56

67
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
78

8-
[package.metadata.workspaces]
9-
independent = true
10-
119
[dependencies]
1210
bincode = { workspace = true }
1311
luwen = { workspace = true }

0 commit comments

Comments
 (0)