Skip to content

Commit 17abdf3

Browse files
committed
feat: adding package sining step
1 parent c20c686 commit 17abdf3

2 files changed

Lines changed: 41 additions & 4 deletions

File tree

.github/workflows/publish.yml

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ on:
44
push:
55
branches:
66
- main
7-
7+
88
permissions:
9-
id-token: write # Required for OIDC
9+
id-token: write # Required for npm OIDC and Provenance
1010
contents: read
1111

1212
jobs:
@@ -16,10 +16,47 @@ jobs:
1616
steps:
1717
- name: 📚 checkout
1818
uses: actions/checkout@v6
19+
1920
- name: 🟢 node
2021
uses: actions/setup-node@v6
2122
with:
2223
node-version: 24
2324
registry-url: https://registry.npmjs.org
25+
26+
# --- Pack & sign with Unity's official Package Manager CLI ---
27+
# https://docs.unity3d.com/6000.3/Documentation/Manual/upm-cli.html
28+
# Service account must hold the "Package Manager Package Signer" role.
29+
- name: 🔏 pack & sign unity package
30+
env:
31+
UPM_SERVICE_ACCOUNT_KEY_ID: ${{ secrets.UPM_SERVICE_ACCOUNT_KEY_ID }}
32+
UPM_SERVICE_ACCOUNT_KEY_SECRET: ${{ secrets.UPM_SERVICE_ACCOUNT_KEY_SECRET }}
33+
UNITY_ORGANIZATION_ID: ${{ secrets.UNITY_ORG_ID }}
34+
run: |
35+
set -euo pipefail
36+
37+
# Install the official UPM CLI (adds `upm` to PATH via shell profile,
38+
# which a non-interactive CI shell does NOT pick up — so resolve the
39+
# binary directly below).
40+
curl -fsSL https://cdn.packages.unity.com/upm-cli/install.sh | bash
41+
42+
UPM_BIN="$(command -v upm || true)"
43+
if [ -z "${UPM_BIN}" ]; then
44+
UPM_BIN="$(find "${HOME}" -type f -name upm 2>/dev/null | head -n1)"
45+
fi
46+
if [ -z "${UPM_BIN}" ]; then
47+
echo "::error::Could not locate the 'upm' binary after install." >&2
48+
exit 1
49+
fi
50+
51+
"${UPM_BIN}" --version
52+
53+
# Packs the package in the repo root and writes the SIGNED tarball to ./dist
54+
"${UPM_BIN}" pack . --organization-id "${UNITY_ORGANIZATION_ID}" --destination ./dist
55+
56+
# --- Publish the SIGNED tarball (do NOT let npm repack the source) ---
2457
- name: 🚀 publish
25-
run: npm publish --access public
58+
run: |
59+
set -euo pipefail
60+
TARBALL="$(ls ./dist/*.tgz | head -n1)"
61+
echo "Publishing ${TARBALL}"
62+
npm publish "${TARBALL}" --access public --provenance

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name":"fr.jeanf.propertydrawer",
3-
"version":"1.1.11",
3+
"version":"1.1.12",
44
"displayName":"Property drawer",
55
"description":"This package helps hiding certain properties from the inspector using conditions",
66
"unity": "2021.3",

0 commit comments

Comments
 (0)