Skip to content

Commit fbfca47

Browse files
authored
fix(release): restore clean publish path (#89)
* fix(tools): verify cargo-binstall with pinned flag (#87) * fix(release): resume tagged publish runs * fix(release): seed swift package release
1 parent 517c83f commit fbfca47

19 files changed

Lines changed: 308 additions & 41 deletions

.github/scripts/check-release-intent.sh

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,25 @@ for (const [path, version] of Object.entries(data).sort(([left], [right]) => lef
8787
'
8888
}
8989

90+
allowed_bootstrap_release_manifest_seed() {
91+
local change="${1:?allowed_bootstrap_release_manifest_seed requires a change row}"
92+
[[ "${change}" == "src/sdks/swift=0.0.0 -> 0.5.0" ]]
93+
}
94+
95+
filter_release_manifest_changes() {
96+
local mode="${1:?filter_release_manifest_changes requires allow or deny}"
97+
local change
98+
while IFS= read -r change; do
99+
[[ -z "${change}" ]] && continue
100+
if allowed_bootstrap_release_manifest_seed "${change}"; then
101+
[[ "${mode}" == "allow" ]] && printf '%s\n' "${change}"
102+
else
103+
[[ "${mode}" == "deny" ]] && printf '%s\n' "${change}"
104+
fi
105+
done
106+
return 0
107+
}
108+
90109
base_release_manifest_versions="$(release_manifest_versions_from_ref "${base_ref}")"
91110
head_release_manifest_versions="$(release_manifest_versions_from_ref "${head_ref}")"
92111

@@ -111,8 +130,14 @@ if [[ -n "${base_release_manifest_versions}" ]]; then
111130
else
112131
changed_existing_release_manifest_versions=""
113132
fi
133+
allowed_bootstrap_release_manifest_versions="$(
134+
filter_release_manifest_changes allow <<< "${changed_existing_release_manifest_versions}"
135+
)"
136+
disallowed_changed_existing_release_manifest_versions="$(
137+
filter_release_manifest_changes deny <<< "${changed_existing_release_manifest_versions}"
138+
)"
114139

115-
if [[ -n "${changed_existing_versions}${changed_existing_release_manifest_versions}" && "${is_release_pr}" != true ]]; then
140+
if [[ -n "${changed_existing_versions}${disallowed_changed_existing_release_manifest_versions}" && "${is_release_pr}" != true ]]; then
116141
cat >&2 <<EOF
117142
This PR changes one or more workspace package versions or release-please
118143
manifest versions.
@@ -144,7 +169,10 @@ Head release-please manifest versions:
144169
${head_release_manifest_versions}
145170
146171
Changed existing release-please manifest versions:
147-
${changed_existing_release_manifest_versions}
172+
${disallowed_changed_existing_release_manifest_versions}
173+
174+
Allowed bootstrap release-please manifest seed changes:
175+
${allowed_bootstrap_release_manifest_versions}
148176
EOF
149177
exit 1
150178
fi

.github/scripts/resolve-release-head.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ if [[ "$release_sha" != "$workflow_sha" ]]; then
4343
while IFS= read -r path; do
4444
[[ -n "$path" ]] || continue
4545
case "$path" in
46-
.github/actions/*|.github/scripts/*|.github/workflows/*|tools/policy/*|tools/release/*|tools/xtask/*|docs/maintainers/release-setup.md)
46+
.github/actions/*|.github/scripts/*|.github/workflows/*|tools/dev/*|tools/policy/*|tools/release/*|tools/xtask/*|docs/maintainers/release-setup.md)
4747
;;
4848
*)
4949
disallowed+=("$path")

.github/workflows/release.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,16 @@ jobs:
259259
- name: Plan product releases
260260
id: release_plan
261261
run: |
262-
tools/dev/bun.sh tools/release/release_plan.mjs --from-product-tags --include-current-tags --head-ref "$RELEASE_HEAD_SHA" --format github-output >> "$GITHUB_OUTPUT"
262+
release_plan_args=(
263+
--from-product-tags
264+
--include-current-tags
265+
--head-ref "$RELEASE_HEAD_SHA"
266+
--format github-output
267+
)
268+
if [[ "${{ inputs.operation }}" == "publish" ]]; then
269+
release_plan_args+=(--include-current-version-tags)
270+
fi
271+
tools/dev/bun.sh tools/release/release_plan.mjs "${release_plan_args[@]}" >> "$GITHUB_OUTPUT"
263272
264273
- name: No package release planned
265274
if: ${{ steps.release_plan.outputs.has_release_changes != 'true' }}

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"src/sdks/rust": "0.0.0",
44
"src/runtimes/broker": "0.0.0",
55
"src/runtimes/node-direct": "0.0.0",
6-
"src/sdks/swift": "0.0.0",
6+
"src/sdks/swift": "0.5.0",
77
"src/sdks/kotlin": "0.0.0",
88
"src/sdks/react-native": "0.0.0",
99
"src/sdks/js": "0.0.0",

docs/maintainers/release-setup.md

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,19 +89,24 @@ tools/dev/bun.sh tools/release/release-check.mjs
8989
```
9090

9191
For normal releases, leave the `Release` workflow's `release_commit` input
92-
empty. If a publish or dry-run fails and a later `main` commit only fixes
93-
release tooling, rerun `Release` from current `main` with `release_commit` set
94-
to the full 40-character SHA that should be published. The workflow still runs
95-
the latest release scripts, but it plans the release, selects CI artifacts,
96-
checks product tags, and verifies publication against that selected release
97-
commit. During `publish`, the workflow creates a temporary release-please target
98-
branch at the selected commit so product tags and GitHub releases point at the
99-
published source commit, then removes that temporary branch.
92+
empty. If release-please has already created product tags but a later publish
93+
step failed, rerun `Release` from current `main`; `publish` keeps selecting the
94+
current-version product tags so the idempotent publish steps can complete
95+
missing assets and registry outputs. If a publish or dry-run fails and a later
96+
`main` commit only fixes release tooling, rerun `Release` from current `main`
97+
with `release_commit` set to the full 40-character SHA that should be
98+
published. The workflow still runs the latest release scripts, but it plans the
99+
release, selects CI artifacts, checks product tags, and verifies publication
100+
against that selected release commit. During `publish`, the workflow creates a
101+
temporary release-please target branch at the selected commit so product tags
102+
and GitHub releases point at the published source commit, then removes that
103+
temporary branch.
100104

101105
Do not use `release_commit` to skip CI for product source, version, changelog,
102106
or release metadata changes. The workflow rejects lagging release commits unless
103107
the intervening files are release tooling such as `.github/workflows/`,
104-
`.github/scripts/`, `tools/release/`, `tools/policy/`, or `tools/xtask/`.
108+
`.github/scripts/`, `tools/dev/`, `tools/release/`, `tools/policy/`, or
109+
`tools/xtask/`.
105110

106111
## crates.io
107112

@@ -325,6 +330,9 @@ Setup:
325330
the repository. The release workflow creates two tags:
326331
- `oliphaunt-swift-v<version>` for the product release identity.
327332
- `<version>` for SwiftPM package resolution.
333+
Legacy pglite releases already use unscoped `0.1.0` through `0.5.1` tags, so
334+
the first Oliphaunt Swift release is bootstrapped from a `0.5.0` release-please
335+
baseline and minor-bumped by the introductory feature commits to `0.6.0`.
328336
3. Publish the compatible `liboliphaunt-native-v<version>` GitHub release assets
329337
before or during the same release plan. The Swift SDK pins that native core
330338
version in `src/sdks/swift/LIBOLIPHAUNT_VERSION`.

docs/maintainers/release.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,20 +101,24 @@ from release-affecting commits since its own latest product tag.
101101
Product tags are scoped by product:
102102

103103
- `liboliphaunt-native-v0.1.0`
104-
- `liboliphaunt-wasix-v0.5.1`
104+
- `liboliphaunt-wasix-v0.1.0`
105105
- `oliphaunt-rust-v0.1.0`
106106
- `oliphaunt-broker-v0.1.0`
107107
- `oliphaunt-node-direct-v0.1.0`
108-
- `oliphaunt-swift-v0.1.0`
108+
- `oliphaunt-swift-v0.6.0`
109109
- `oliphaunt-kotlin-v0.1.0`
110110
- `oliphaunt-react-native-v0.1.0`
111111
- `oliphaunt-js-v0.1.0`
112-
- `oliphaunt-wasix-rust-v0.5.1`
112+
- `oliphaunt-wasix-rust-v0.1.0`
113113
- `oliphaunt-extension-vector-v0.1.0`
114114

115115
The WASIX Rust crate can read legacy unscoped tags for migration history, but
116116
new product identity uses product-scoped tags.
117117

118+
SwiftPM also needs an unscoped semver tag. Legacy pglite releases already own
119+
`0.1.0` through `0.5.1`, so the first Oliphaunt Swift release starts at
120+
`0.6.0` while its product identity remains `oliphaunt-swift-v0.6.0`.
121+
118122
## Native Artifacts
119123

120124
Native runtime artifacts are release assets consumed by SDK tooling. The active

release-please-config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@
210210
"release-type": "simple",
211211
"component": "oliphaunt-swift",
212212
"package-name": "oliphaunt-swift",
213+
"bump-patch-for-minor-pre-major": false,
213214
"version-file": "VERSION",
214215
"changelog-path": "CHANGELOG.md"
215216
},

src/sdks/react-native/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"types": "lib/typescript/index.d.ts",
2222
"react-native": "lib/module/index.js",
2323
"oliphaunt": {
24-
"swiftSdkVersion": "0.0.0",
24+
"swiftSdkVersion": "0.5.0",
2525
"kotlinSdkVersion": "0.0.0"
2626
},
2727
"files": [

src/sdks/swift/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.0.0
1+
0.5.0

tools/dev/bootstrap-tools.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ has_command() {
2727
installed_tool_version() {
2828
binary="$1"
2929
case "$(basename "$binary")" in
30+
cargo-binstall) "$binary" -V 2>/dev/null || true ;;
3031
cargo-hack) PATH="$(dirname "$binary"):$PATH" cargo hack --version 2>/dev/null || true ;;
3132
cargo-semver-checks) PATH="$(dirname "$binary"):$PATH" cargo semver-checks --version 2>/dev/null || true ;;
3233
*) "$binary" --version 2>/dev/null || true ;;
@@ -102,7 +103,7 @@ install_cargo_tool() {
102103
install_cargo_binstall() {
103104
local_binary="$cargo_bin_dir/cargo-binstall"
104105
if [ -x "$local_binary" ]; then
105-
output="$("$local_binary" -V 2>/dev/null || true)"
106+
output="$(installed_tool_version "$local_binary")"
106107
if version_output_matches "$output" "$CARGO_BINSTALL_VERSION"; then
107108
echo "cargo-binstall already installed: $output"
108109
return
@@ -156,7 +157,7 @@ install_cargo_binstall() {
156157
fi
157158
install "$binstall_bin" "$local_binary"
158159
rm -rf "$tmp"
159-
output="$("$local_binary" -V 2>/dev/null || true)"
160+
output="$(installed_tool_version "$local_binary")"
160161
require_pinned_version cargo-binstall "$CARGO_BINSTALL_VERSION" "$output"
161162
}
162163

0 commit comments

Comments
 (0)