Skip to content

Commit 18bbd4f

Browse files
authored
fix(plugins): publish each ABI as a new plugin version, verify built kit matches label (#1380) (#1399)
* fix(plugins): release each ABI as a new plugin version and verify the built kit matches its label (#1380) * refactor(plugins): resolve tags from remote, verify both arches, and refuse cross-ABI release overwrites (#1380)
1 parent b87d161 commit 18bbd4f

2 files changed

Lines changed: 41 additions & 7 deletions

File tree

.github/workflows/build-plugin.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,26 @@ jobs:
248248
./scripts/build-plugin.sh "${{ steps.plugin.outputs.target }}" arm64 "${{ steps.plugin.outputs.version }}"
249249
./scripts/build-plugin.sh "${{ steps.plugin.outputs.target }}" x86_64 "${{ steps.plugin.outputs.version }}"
250250
251+
- name: Verify built PluginKit version matches the release label
252+
run: |
253+
BUNDLE_NAME="${{ steps.plugin.outputs.bundleName }}"
254+
EXPECTED="${{ matrix.pluginKitVersion }}"
255+
for ARCH in arm64 x86_64; do
256+
WORK=$(mktemp -d)
257+
unzip -oq "build/Plugins/${BUNDLE_NAME}-${ARCH}.zip" -d "$WORK"
258+
PLIST=$(find "$WORK" -path '*.tableplugin/Contents/Info.plist' | head -1)
259+
if [ -z "$PLIST" ]; then
260+
echo "::error::Could not find Info.plist in the built ${BUNDLE_NAME}-${ARCH} bundle."
261+
exit 1
262+
fi
263+
ACTUAL=$(plutil -extract TableProPluginKitVersion raw "$PLIST")
264+
if [ "$ACTUAL" != "$EXPECTED" ]; then
265+
echo "::error::${BUNDLE_NAME}-${ARCH} was built for PluginKit $ACTUAL but this release is labeled PluginKit $EXPECTED. Refusing to publish a mislabeled binary. Re-release from a commit whose plugin Info.plist matches the target PluginKit version."
266+
exit 1
267+
fi
268+
echo "Verified ${BUNDLE_NAME}-${ARCH}: built PluginKit $ACTUAL matches the release label."
269+
done
270+
251271
- name: Read checksums
252272
id: sha
253273
run: |
@@ -290,6 +310,13 @@ jobs:
290310
- ARM64: \`$ARM64_SHA\`
291311
- x86_64: \`$X86_SHA\`"
292312
313+
EXISTING_PKV=$(gh release view "$TAG" --json body --jq .body 2>/dev/null \
314+
| grep -oiE 'PluginKit [0-9]+' | grep -oE '[0-9]+' | head -1 || true)
315+
if [ -n "$EXISTING_PKV" ] && [ "$EXISTING_PKV" != "$PKV" ]; then
316+
echo "::error::Release $TAG already exists for PluginKit $EXISTING_PKV. Refusing to overwrite it with PluginKit $PKV; publish the new ABI under a new plugin version."
317+
exit 1
318+
fi
319+
293320
gh release delete "$TAG" --yes 2>/dev/null || true
294321
gh release create "$TAG" \
295322
--title "$DISPLAY_NAME v$VERSION" \

scripts/release-all-plugins.sh

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@
44
# Usage: ./scripts/release-all-plugins.sh <pluginKitVersion>
55
# Example: ./scripts/release-all-plugins.sh 14
66
#
7-
# Reads the latest tag for each plugin from git, pairs it with the given
8-
# pluginKitVersion, and fires one workflow_dispatch on build-plugin.yml so all
9-
# plugins build in parallel as a single matrix run.
7+
# Reads the latest tag for each plugin, bumps the patch version, and pairs the
8+
# NEW version with the given pluginKitVersion, then fires one workflow_dispatch
9+
# on build-plugin.yml so all plugins build in parallel as a single matrix run.
10+
#
11+
# An ABI bump must publish fresh binaries at a NEW release tag. Reusing the
12+
# existing tag overwrites that release's assets, which breaks the previous ABI's
13+
# consumers and serves stale copies from the GitHub release CDN.
1014
#
1115
# Prerequisites: gh CLI authenticated, run from repo root.
1216

@@ -61,14 +65,17 @@ done
6165

6266
TAG_LIST=""
6367
FIRST=true
64-
echo "Resolving latest tag for each plugin:"
68+
echo "Resolving next release version for each plugin (PluginKit $PKV):"
6569
for PLUGIN in "${PLUGINS[@]}"; do
66-
LATEST_TAG=$(git tag -l "plugin-${PLUGIN}-v*" | sort -V | tail -1)
70+
LATEST_TAG=$(git ls-remote --tags --refs origin "plugin-${PLUGIN}-v*" \
71+
| sed 's#.*/##' | sort -V | tail -1)
6772
if [ -z "$LATEST_TAG" ]; then
68-
echo " WARNING: No tag found for plugin-${PLUGIN}-v*. Skipping."
73+
echo " WARNING: No remote tag found for plugin-${PLUGIN}-v*. Skipping."
6974
continue
7075
fi
71-
PAIR="${LATEST_TAG}:${PKV}"
76+
LATEST_VER="${LATEST_TAG#plugin-${PLUGIN}-v}"
77+
NEW_TAG="plugin-${PLUGIN}-v${LATEST_VER%.*}.$(( ${LATEST_VER##*.} + 1 ))"
78+
PAIR="${NEW_TAG}:${PKV}"
7279
if [ "$FIRST" = true ]; then
7380
TAG_LIST="$PAIR"
7481
FIRST=false

0 commit comments

Comments
 (0)