Skip to content

Commit 33ba66e

Browse files
committed
fix: complete crates.io publish chain, remove PyPI job
- Publish all 5 crates in dependency order: hm-util → hm-pipeline-ir → hm-plugin-protocol → hm-plugin-cloud → harmont-cli - Make hm-plugin-cloud publishable (was publish=false) - Move hm-plugin-cloud to workspace deps (was path-only) - Remove PyPI publish job (DSLs are embedded in the binary) - Remove id-token:write permission (was only needed for PyPI OIDC)
1 parent 0f68016 commit 33ba66e

4 files changed

Lines changed: 38 additions & 46 deletions

File tree

.github/workflows/release.yml

Lines changed: 33 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ on:
77

88
permissions:
99
contents: write
10-
id-token: write
1110

1211
concurrency:
1312
group: release-${{ github.ref }}
@@ -34,13 +33,35 @@ jobs:
3433
run: |
3534
VERSION="${GITHUB_REF_NAME#v}"
3635
echo "VERSION=$VERSION" >> "$GITHUB_ENV"
36+
37+
# Bump crate versions
38+
sed -i "0,/version = \"0.0.0-dev\"/s//version = \"$VERSION\"/" crates/hm-util/Cargo.toml
3739
sed -i "0,/version = \"0.0.0-dev\"/s//version = \"$VERSION\"/" crates/hm-pipeline-ir/Cargo.toml
3840
sed -i "0,/version = \"0.0.0-dev\"/s//version = \"$VERSION\"/" crates/hm-plugin-protocol/Cargo.toml
41+
sed -i "0,/version = \"0.0.0-dev\"/s//version = \"$VERSION\"/" crates/hm-plugin-cloud/Cargo.toml
3942
sed -i "0,/version = \"0.0.0-dev\"/s//version = \"$VERSION\"/" crates/hm/Cargo.toml
43+
44+
# Rewrite workspace.dependencies pins so dependents resolve to the
45+
# tagged version (cargo publish strips path deps; the version field
46+
# is what consumers will receive).
47+
sed -i "s|hm-util = { path = \"crates/hm-util\", version = \"0.0.0-dev\" }|hm-util = { path = \"crates/hm-util\", version = \"$VERSION\" }|" Cargo.toml
4048
sed -i "s|hm-pipeline-ir = { path = \"crates/hm-pipeline-ir\", version = \"0.0.0-dev\" }|hm-pipeline-ir = { path = \"crates/hm-pipeline-ir\", version = \"$VERSION\" }|" Cargo.toml
4149
sed -i "s|hm-plugin-protocol = { path = \"crates/hm-plugin-protocol\", version = \"0.0.0-dev\" }|hm-plugin-protocol = { path = \"crates/hm-plugin-protocol\", version = \"$VERSION\" }|" Cargo.toml
50+
sed -i "s|hm-plugin-cloud = { path = \"crates/hm-plugin-cloud\", version = \"0.0.0-dev\" }|hm-plugin-cloud = { path = \"crates/hm-plugin-cloud\", version = \"$VERSION\" }|" Cargo.toml
51+
4252
cargo check --workspace --exclude hm-fixtures
4353
54+
- name: Publish hm-util
55+
run: |
56+
if curl -sf -A "harmont-release-ci (github-actions)" "https://crates.io/api/v1/crates/hm-util/$VERSION" > /dev/null 2>&1; then
57+
echo "hm-util@$VERSION already published, skipping"
58+
else
59+
cargo publish -p hm-util --token ${{ secrets.CRATES_IO_TOKEN }} --allow-dirty
60+
fi
61+
62+
- name: Wait for crates.io index
63+
run: sleep 30
64+
4465
- name: Publish hm-pipeline-ir
4566
run: |
4667
if curl -sf -A "harmont-release-ci (github-actions)" "https://crates.io/api/v1/crates/hm-pipeline-ir/$VERSION" > /dev/null 2>&1; then
@@ -63,6 +84,17 @@ jobs:
6384
- name: Wait for crates.io index
6485
run: sleep 30
6586

87+
- name: Publish hm-plugin-cloud
88+
run: |
89+
if curl -sf -A "harmont-release-ci (github-actions)" "https://crates.io/api/v1/crates/hm-plugin-cloud/$VERSION" > /dev/null 2>&1; then
90+
echo "hm-plugin-cloud@$VERSION already published, skipping"
91+
else
92+
cargo publish -p hm-plugin-cloud --token ${{ secrets.CRATES_IO_TOKEN }} --allow-dirty
93+
fi
94+
95+
- name: Wait for crates.io index
96+
run: sleep 30
97+
6698
- name: Publish harmont-cli
6799
run: |
68100
if curl -sf -A "harmont-release-ci (github-actions)" "https://crates.io/api/v1/crates/harmont-cli/$VERSION" > /dev/null 2>&1; then
@@ -71,48 +103,6 @@ jobs:
71103
cargo publish -p harmont-cli --token ${{ secrets.CRATES_IO_TOKEN }} --allow-dirty
72104
fi
73105
74-
pypi-publish:
75-
name: Publish to PyPI
76-
runs-on: ubuntu-latest
77-
timeout-minutes: 30
78-
environment:
79-
name: release
80-
url: https://pypi.org/project/harmont/
81-
permissions:
82-
id-token: write
83-
steps:
84-
- uses: actions/checkout@v4
85-
86-
- uses: actions/setup-python@v5
87-
with:
88-
python-version: "3.12"
89-
90-
- name: Set version from tag
91-
run: |
92-
VERSION="${GITHUB_REF_NAME#v}"
93-
echo "VERSION=$VERSION" >> "$GITHUB_ENV"
94-
sed -i '0,/version = "0.0.0-dev"/s//version = "'"$VERSION"'"/' dsls/harmont-py/pyproject.toml
95-
grep -n "^version" dsls/harmont-py/pyproject.toml
96-
97-
- name: Install build
98-
run: python -m pip install --upgrade build
99-
100-
- name: Build sdist and wheel
101-
working-directory: dsls/harmont-py
102-
run: python -m build
103-
104-
- name: Inspect dist
105-
working-directory: dsls/harmont-py
106-
run: |
107-
ls -la dist/
108-
test -f dist/harmont-${VERSION}.tar.gz
109-
test -f dist/harmont-${VERSION}-py3-none-any.whl
110-
111-
- name: Publish to PyPI via Trusted Publishing
112-
uses: pypa/gh-action-pypi-publish@release/v1
113-
with:
114-
packages-dir: dsls/harmont-py/dist/
115-
116106
build-binary:
117107
name: Build ${{ matrix.target }}
118108
timeout-minutes: 30

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ repository = "https://github.com/harmont-dev/harmont-cli"
2424

2525
[workspace.dependencies]
2626
hm-plugin-protocol = { path = "crates/hm-plugin-protocol", version = "0.0.0-dev" }
27+
hm-plugin-cloud = { path = "crates/hm-plugin-cloud", version = "0.0.0-dev" }
2728
hm-pipeline-ir = { path = "crates/hm-pipeline-ir", version = "0.0.0-dev" }
2829
hm-util = { path = "crates/hm-util", version = "0.0.0-dev" }
2930
hm-dsl-engine = { path = "crates/hm-dsl-engine", version = "0.0.0-dev" }

crates/hm-plugin-cloud/Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
[package]
22
name = "hm-plugin-cloud"
3-
version = "0.1.0"
3+
version = "0.0.0-dev"
44
edition.workspace = true
55
license.workspace = true
66
repository.workspace = true
77
description = "Cloud client library for the hm CLI."
8-
publish = false
8+
keywords = ["ci", "harmont", "cloud"]
9+
categories = ["command-line-utilities"]
910

1011
[lib]
1112
path = "src/lib.rs"

crates/hm/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ which = "6"
6464
hm-pipeline-ir = { workspace = true }
6565
hm-plugin-protocol = { workspace = true }
6666
hm-util = { workspace = true }
67-
hm-plugin-cloud = { path = "../hm-plugin-cloud" }
67+
hm-plugin-cloud = { workspace = true }
6868
hm-dsl-engine = { workspace = true }
6969
daggy = { workspace = true }
7070
schemars = { workspace = true }

0 commit comments

Comments
 (0)