Skip to content
Python

fix(ci): locate nested Linux release artifacts (#36)

feitianxiangb370663870c7
diff --git a/.github/workflows/linux-lifecycle.yml b/.github/workflows/linux-lifecycle.yml
index 20faf63..462d164 100644
--- a/.github/workflows/linux-lifecycle.yml
+++ b/.github/workflows/linux-lifecycle.yml
@@ -122,19 +122,25 @@ jobs:
shell: bash
run: |
set -euo pipefail
+ shopt -s globstar nullglob
version=$(node -p 'require("./package.json").version')
node scripts/verify-release-version.mjs \
--channel stable \
--version "$version" \
--build-number "$(node -p 'require("./package.json").release.build_number')" \
--tag "$GITHUB_REF_NAME"
+ mkdir -p publish-assets
for arch in x64 arm64; do
- archive="release-assets/memhub-runtime-v${version}-linux-${arch}.tar.gz"
- test -f "$archive"
- test -f "$archive.sha256"
+ name="memhub-runtime-v${version}-linux-${arch}.tar.gz"
+ archives=(release-assets/**/"$name")
+ checksums=(release-assets/**/"$name.sha256")
+ test "${#archives[@]}" -eq 1
+ test "${#checksums[@]}" -eq 1
+ cp -- "${archives[0]}" "publish-assets/$name"
+ cp -- "${checksums[0]}" "publish-assets/$name.sha256"
(
- cd release-assets
- sha256sum -c "$(basename "$archive.sha256")"
+ cd publish-assets
+ sha256sum -c "$name.sha256"
)
done
- name: Upload Linux assets to a draft GitHub Release
@@ -160,7 +166,7 @@ jobs:
--title "$GITHUB_REF_NAME"
fi
gh release upload "$GITHUB_REF_NAME" \
- release-assets/memhub-runtime-v*-linux-*.tar.gz \
- release-assets/memhub-runtime-v*-linux-*.tar.gz.sha256 \
+ publish-assets/memhub-runtime-v*-linux-*.tar.gz \
+ publish-assets/memhub-runtime-v*-linux-*.tar.gz.sha256 \
--repo "$GITHUB_REPOSITORY" \
--clobber
diff --git a/memhub/scripts/platform/linux/linux-runtime-scripts.test.mjs b/memhub/scripts/platform/linux/linux-runtime-scripts.test.mjs
index 1b52b1c..9e3f542 100644
--- a/memhub/scripts/platform/linux/linux-runtime-scripts.test.mjs
+++ b/memhub/scripts/platform/linux/linux-runtime-scripts.test.mjs
@@ -117,9 +117,19 @@ describe("Linux runtime scripts", () => {
workflow,
/verify-release-version\.mjs[\s\S]*--channel stable/,
);
+ assert.match(workflow, /shopt -s globstar nullglob/);
+ assert.match(workflow, /archives=\(release-assets\/\*\*\/"\$name"\)/);
+ assert.match(
+ workflow,
+ /cp -- "\$\{archives\[0\]\}" "publish-assets\/\$name"/,
+ );
assert.match(workflow, /sha256sum -c/);
assert.match(workflow, /--json isDraft[\s\S]*--jq \.isDraft/);
assert.match(workflow, /gh release create[\s\S]*--draft/);
assert.match(workflow, /gh release upload[\s\S]*--clobber/);
+ assert.match(
+ workflow,
+ /publish-assets\/memhub-runtime-v\*-linux-\*\.tar\.gz/,
+ );
});
});