Skip to content

Commit 0f68016

Browse files
committed
fix: add hm-pipeline-ir to publish order, make release idempotent
- Publish hm-pipeline-ir before hm-plugin-protocol (dependency) - Version-bump hm-pipeline-ir Cargo.toml + workspace dep pin - Use gh release upload --clobber if release already exists
1 parent 0fa860b commit 0f68016

1 file changed

Lines changed: 26 additions & 9 deletions

File tree

.github/workflows/release.yml

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,24 @@ jobs:
3434
run: |
3535
VERSION="${GITHUB_REF_NAME#v}"
3636
echo "VERSION=$VERSION" >> "$GITHUB_ENV"
37+
sed -i "0,/version = \"0.0.0-dev\"/s//version = \"$VERSION\"/" crates/hm-pipeline-ir/Cargo.toml
3738
sed -i "0,/version = \"0.0.0-dev\"/s//version = \"$VERSION\"/" crates/hm-plugin-protocol/Cargo.toml
3839
sed -i "0,/version = \"0.0.0-dev\"/s//version = \"$VERSION\"/" crates/hm/Cargo.toml
39-
# Rewrite workspace.dependencies pins so dependents resolve to the
40-
# tagged version (cargo publish strips path deps; the version field
41-
# is what consumers will receive).
40+
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
4241
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
4342
cargo check --workspace --exclude hm-fixtures
4443
44+
- name: Publish hm-pipeline-ir
45+
run: |
46+
if curl -sf -A "harmont-release-ci (github-actions)" "https://crates.io/api/v1/crates/hm-pipeline-ir/$VERSION" > /dev/null 2>&1; then
47+
echo "hm-pipeline-ir@$VERSION already published, skipping"
48+
else
49+
cargo publish -p hm-pipeline-ir --token ${{ secrets.CRATES_IO_TOKEN }} --allow-dirty
50+
fi
51+
52+
- name: Wait for crates.io index
53+
run: sleep 30
54+
4555
- name: Publish hm-plugin-protocol
4656
run: |
4757
if curl -sf -A "harmont-release-ci (github-actions)" "https://crates.io/api/v1/crates/hm-plugin-protocol/$VERSION" > /dev/null 2>&1; then
@@ -172,12 +182,19 @@ jobs:
172182
path: artifacts
173183
merge-multiple: true
174184

175-
- name: Create release
185+
- name: Create or update release
176186
env:
177187
GH_TOKEN: ${{ github.token }}
178188
run: |
179-
gh release create "$GITHUB_REF_NAME" \
180-
--repo "$GITHUB_REPOSITORY" \
181-
--title "$GITHUB_REF_NAME" \
182-
--generate-notes \
183-
artifacts/*
189+
if gh release view "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" > /dev/null 2>&1; then
190+
gh release upload "$GITHUB_REF_NAME" \
191+
--repo "$GITHUB_REPOSITORY" \
192+
--clobber \
193+
artifacts/*
194+
else
195+
gh release create "$GITHUB_REF_NAME" \
196+
--repo "$GITHUB_REPOSITORY" \
197+
--title "$GITHUB_REF_NAME" \
198+
--generate-notes \
199+
artifacts/*
200+
fi

0 commit comments

Comments
 (0)