Compare commits

...

17 Commits

Author SHA1 Message Date
guokexin.02
b3ac5216ce test: prepare node 24 release rehearsal 2026-07-28 20:25:55 +08:00
guokexin.02
39ea3e73b6 ci: upgrade release actions to node 24 2026-07-28 20:24:49 +08:00
guokexin.02
986a7f9c2d test: remove beta release approval rehearsal 2026-07-28 20:11:58 +08:00
guokexin.02
be318cdd83 fix: publish verified npm tarball as local file 2026-07-28 19:53:26 +08:00
guokexin.02
d31666fc06 test: prepare beta release approval rehearsal 2026-07-28 19:35:00 +08:00
guokexin.02
681d3a1521 test: remove release rehearsal hooks 2026-07-28 19:08:51 +08:00
guokexin.02
6bb34823da test: isolate GitHub publish rejection 2026-07-28 18:58:23 +08:00
guokexin.02
1b8085140a test: target GitHub publish rejection 2026-07-28 18:49:11 +08:00
guokexin.02
94edc7462a test: rehearse GitHub release publish rejection 2026-07-28 18:40:27 +08:00
guokexin.02
ec25e0df90 test: rehearse macOS code signature verification 2026-07-28 18:31:39 +08:00
guokexin.02
83dbf6eae0 test: rehearse release archive integrity 2026-07-28 18:21:37 +08:00
guokexin.02
bf40df896f test: rehearse invalid notarization key 2026-07-28 18:14:18 +08:00
guokexin.02
b65f977d9c test: rehearse invalid signing certificate 2026-07-28 18:06:53 +08:00
guokexin.02
cb9fc32717 test: rehearse invalid signing certificate 2026-07-28 17:52:23 +08:00
guokexin.02
ac0fb6d807 test: rehearse missing signing password 2026-07-28 17:50:00 +08:00
guokexin.02
fc2ddf2bf5 test: allow beta.1 preflight rehearsal 2026-07-28 17:46:14 +08:00
guokexin.02
51165e4f6a test: add release preflight rehearsal 2026-07-28 17:27:25 +08:00
4 changed files with 30 additions and 27 deletions

View File

@@ -23,7 +23,7 @@ jobs:
channel: ${{ steps.validate.outputs.channel }}
prerelease: ${{ steps.validate.outputs.prerelease }}
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
with:
fetch-depth: 0
persist-credentials: false
@@ -48,7 +48,9 @@ jobs:
head_sha="$(git rev-parse --verify 'HEAD^{commit}')"
tag_sha="$(git rev-parse --verify "refs/tags/${TAG}^{commit}")"
[[ "$tag_sha" == "$head_sha" ]] || { echo "Tag ${TAG} does not resolve to checked-out HEAD." >&2; exit 1; }
git merge-base --is-ancestor "$head_sha" FETCH_HEAD || { echo "Tag ${TAG} is not contained in origin/main." >&2; exit 1; }
if [[ "$TAG" != "v1.0.78-beta.13" ]]; then
git merge-base --is-ancestor "$head_sha" FETCH_HEAD || { echo "Tag ${TAG} is not contained in origin/main." >&2; exit 1; }
fi
node - "$preflight_file" "$head_sha" "$GITHUB_OUTPUT" <<'NODE'
const fs = require("node:fs");
@@ -67,14 +69,14 @@ jobs:
permissions:
contents: read
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6
with:
go-version: '1.23'
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
with:
python-version: '3.x'
- uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
@@ -91,6 +93,7 @@ jobs:
MACOS_SIGN_P12: ${{ secrets.MACOS_SIGN_P12 }}
MACOS_SIGN_PASSWORD: ${{ secrets.MACOS_SIGN_PASSWORD }}
MACOS_TEAM_ID: ${{ vars.MACOS_TEAM_ID }}
TAG: ${{ github.ref_name }}
run: |
set -euo pipefail
set +x
@@ -141,7 +144,7 @@ jobs:
NODE
- name: Upload release candidate
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
with:
name: release-candidate-${{ github.run_id }}
path: release-candidate/
@@ -154,7 +157,7 @@ jobs:
permissions:
contents: write
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
with:
ref: ${{ needs.preflight.outputs.source_sha }}
fetch-depth: 0
@@ -232,7 +235,7 @@ jobs:
archive="lark-cli-${VERSION}-darwin-${ARCH}.tar.gz"
work="$(mktemp -d "${RUNNER_TEMP}/macos-release.XXXXXX")"
trap 'rm -rf -- "$work"' EXIT
gh release download "$TAG" --pattern "$archive" --pattern checksums.txt --dir "$work"
gh release download "$TAG" --repo "$GITHUB_REPOSITORY" --pattern "$archive" --pattern checksums.txt --dir "$work"
awk -v archive="$archive" '$2 == archive { print }' "$work/checksums.txt" > "$work/checksum.txt"
[[ "$(wc -l < "$work/checksum.txt" | tr -d '[:space:]')" == "1" ]] || { echo "checksums.txt must contain exactly one entry for ${archive}." >&2; exit 1; }
(cd "$work" && shasum -a 256 -c checksum.txt)
@@ -245,8 +248,7 @@ jobs:
grep -Fxq "TeamIdentifier=${MACOS_TEAM_ID}" <<<"$details"
grep -Fq 'flags=0x10000(runtime)' <<<"$details"
grep -Eq '^Timestamp=.+' <<<"$details"
spctl --assess --type execute --verbose=4 "$binary" 2>&1 | tee "$work/spctl.txt"
grep -Fq 'source=Notarized Developer ID' "$work/spctl.txt"
codesign --verify --strict --verbose=4 --check-notarization -R='notarized' "$binary"
"$binary" --version | grep -Fq "$VERSION"
publish-github:
@@ -255,7 +257,7 @@ jobs:
permissions:
contents: write
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
with:
ref: ${{ needs.preflight.outputs.source_sha }}
fetch-depth: 0
@@ -282,7 +284,7 @@ jobs:
contents: read
id-token: write
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
with:
ref: ${{ needs.preflight.outputs.source_sha }}
fetch-depth: 0
@@ -335,7 +337,7 @@ jobs:
current="$(npm view @larksuite/cli "dist-tags.${dist_tag}" --json | tr -d '"[:space:]')"
[[ "$current" == "$VERSION" ]] || { echo "Existing npm version is not assigned to ${dist_tag}; repair registry state manually." >&2; exit 1; }
else
npm publish "$tgz" --access public --provenance --tag "$dist_tag"
npm publish "./$tgz" --access public --provenance --tag "$dist_tag"
fi
retry-guidance:
@@ -368,15 +370,14 @@ jobs:
echo "| verify-macos | ${VERIFY_RESULT} |"
echo "| publish-github | ${GITHUB_RESULT} |"
echo "| publish-npm | ${NPM_RESULT} |"
cat <<'EOF'
Select the recovery action from the failed-step diagnosis:
- **preflight:** network or fetch failure → retry preflight. Version/tag validation failure → correct it, then create a new tag.
- **build-sign-notarize:** transient build/service failure → retry build. Code or release configuration issue → correct it, then create a new tag.
- **create-draft-release:** GitHub Draft Release API/upload failure → retry draft. Release-candidate inconsistency → retry build.
- **verify-macos:** runner or network failure → retry only the failed matrix child. Checksum, signing, notarization, or runtime failure → retry build.
- **publish-github:** GitHub publish network failure → retry GitHub publish. Install issue → retry build. Tag/assets inconsistency → stop and publish a new version.
- **publish-npm:** network failure or uncertain publish outcome → retry npm only after verifying whether that version already exists. Integrity mismatch → publish a new version.
EOF
printf '%s\n' \
'' \
'Select the recovery action from the failed-step diagnosis:' \
'' \
'- **preflight:** network or fetch failure → retry preflight. Version/tag validation failure → correct it, then create a new tag.' \
'- **build-sign-notarize:** transient build/service failure → retry build. Code or release configuration issue → correct it, then create a new tag.' \
'- **create-draft-release:** GitHub Draft Release API/upload failure → retry draft. Release-candidate inconsistency → retry build.' \
'- **verify-macos:** runner or network failure → retry only the failed matrix child. Checksum, signing, notarization, or runtime failure → retry build.' \
'- **publish-github:** GitHub publish network failure → retry GitHub publish. Install issue → retry build. Tag/assets inconsistency → stop and publish a new version.' \
'- **publish-npm:** network failure or uncertain publish outcome → retry npm only after verifying whether that version already exists. Integrity mismatch → publish a new version.'
} >> "$GITHUB_STEP_SUMMARY"

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "@larksuite/cli",
"version": "1.0.78",
"version": "1.0.78-beta.13",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@larksuite/cli",
"version": "1.0.78",
"version": "1.0.78-beta.13",
"cpu": [
"x64",
"arm64",

View File

@@ -1,6 +1,6 @@
{
"name": "@larksuite/cli",
"version": "1.0.78",
"version": "1.0.78-beta.13",
"description": "The official CLI for Lark/Feishu open platform",
"bin": {
"lark-cli": "scripts/run.js"

View File

@@ -119,6 +119,8 @@ expect_equal(macos.fetch("runs-on"), "${{ matrix.runner }}", "macOS matrix runne
npm_steps = jobs.fetch("publish-npm").fetch("steps")
pinned_npm = npm_steps.find { |step| step["name"] == "Install pinned npm" }
fail("publish-npm must install npm 11.16.0 for trusted publishing") unless pinned_npm&.fetch("run", nil) == "npm install --global npm@11.16.0"
publish_step = npm_steps.find { |step| step["name"] == "Publish or verify npm package" }
fail("publish-npm must explicitly pass the candidate tarball as a local path") unless publish_step&.fetch("run", nil).include?('npm publish "./$tgz"')
action_references(workflow).each do |reference|
fail("action is not pinned to a full commit SHA: #{reference}") unless reference.match?(%r{\A[^@]+@[0-9a-f]{40}\z})