Skip to content

Commit d7dcccf

Browse files
committed
Improve signed release workflow
1 parent 6a3af0a commit d7dcccf

2 files changed

Lines changed: 31 additions & 18 deletions

File tree

.github/workflows/ci.yml

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,23 @@ jobs:
1616
UPM_SERVICE_ACCOUNT_KEY_ID: ${{ secrets.UPM_SERVICE_ACCOUNT_KEY_ID }}
1717
UPM_SERVICE_ACCOUNT_KEY_SECRET: ${{ secrets.UPM_SERVICE_ACCOUNT_KEY_SECRET }}
1818
UPM_ORG_ID: ${{ secrets.UPM_ORG_ID }}
19-
PACKAGE_NAME: com.example.signed-upm
20-
PACKAGE_VERSION: 1.0.0
19+
DIST_DIR: ${{ runner.temp }}/signed-upm-dist
2120

2221
steps:
2322
- name: Check out repository
2423
uses: actions/checkout@v4
2524

25+
- name: Read package metadata
26+
run: |
27+
package_name="$(jq -r '.name' package/package.json)"
28+
package_version="$(jq -r '.version' package/package.json)"
29+
30+
echo "PACKAGE_NAME=$package_name" >> "$GITHUB_ENV"
31+
echo "PACKAGE_VERSION=$package_version" >> "$GITHUB_ENV"
32+
33+
printf 'Package name: %s\n' "$package_name"
34+
printf 'Package version: %s\n' "$package_version"
35+
2636
- name: Install Unity UPM CLI
2737
run: |
2838
curl -fsSL https://cdn.packages.unity.com/upm-cli/install.sh -o install.sh
@@ -34,32 +44,29 @@ jobs:
3444

3545
- name: Sign package
3646
run: |
37-
upm pack ./package --organization-id "$UPM_ORG_ID" --destination ./dist
47+
mkdir -p "$DIST_DIR"
48+
upm pack ./package --organization-id "$UPM_ORG_ID" --destination "$DIST_DIR"
3849
39-
- name: Verify signed archive
50+
- name: Print signed package info
4051
run: |
4152
shopt -s nullglob
42-
archives=(dist/*.tgz dist/*.tar.gz)
53+
archives=("$DIST_DIR"/*.tgz "$DIST_DIR"/*.tar.gz)
4354
if [ "${#archives[@]}" -ne 1 ]; then
44-
printf 'Expected exactly one package archive in dist, found %s\n' "${#archives[@]}" >&2
55+
printf 'Expected exactly one signed package archive, found %s\n' "${#archives[@]}" >&2
4556
exit 1
4657
fi
4758
4859
archive="${archives[0]}"
49-
expected="dist/${PACKAGE_NAME}-${PACKAGE_VERSION}.tgz"
50-
if [ "$archive" != "$expected" ]; then
51-
printf 'Expected archive %s, found %s\n' "$expected" "$archive" >&2
52-
exit 1
53-
fi
54-
5560
tar -tzf "$archive" | grep -qx 'package/package.json'
56-
actual="$(tar -xOzf "$archive" package/package.json | jq -r '.name + "@" + .version')"
57-
if [ "$actual" != "${PACKAGE_NAME}@${PACKAGE_VERSION}" ]; then
58-
printf 'Expected %s@%s, found %s\n' "$PACKAGE_NAME" "$PACKAGE_VERSION" "$actual" >&2
59-
exit 1
60-
fi
61+
tar -tzf "$archive" | grep -qx 'package/.attestation.p7m'
62+
63+
echo "PACKAGE_ARCHIVE=$archive" >> "$GITHUB_ENV"
64+
printf 'Archive: %s\n' "$(basename "$archive")"
65+
tar -xOzf "$archive" package/package.json | jq '{name, version}'
6166
6267
- name: Create GitHub Release
6368
uses: softprops/action-gh-release@v2
6469
with:
65-
files: dist/com.example.signed-upm-1.0.0.tgz
70+
files: |
71+
${{ runner.temp }}/signed-upm-dist/*.tgz
72+
${{ runner.temp }}/signed-upm-dist/*.tar.gz

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ contains `package/.attestation.p7m` for the package signature. The workflow
5454
also verifies that the archive contains `package/package.json` for
5555
`com.example.signed-upm@1.0.0`, then attaches the signed tarball to the release.
5656

57+
The signed package is uploaded as a GitHub Release asset, not as a GitHub
58+
Actions workflow artifact. Workflow artifacts and logs have retention periods,
59+
but release assets remain attached to the release until the asset or release is
60+
deleted. Keep release assets available so OpenUPM can process older package
61+
versions later.
62+
5763
## OpenUPM
5864

5965
To publish a signed GitHub Release asset through OpenUPM, submit package

0 commit comments

Comments
 (0)