Skip to content

Commit c453116

Browse files
committed
ci: next handling for build targets
[skip ci]
1 parent 54bcc22 commit c453116

1 file changed

Lines changed: 22 additions & 11 deletions

File tree

.github/workflows/npm_release.yml

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ jobs:
4141
outputs:
4242
npm_version: ${{ steps.out.outputs.NPM_VERSION }}
4343
npm_tag: ${{ steps.out.outputs.NPM_TAG }}
44+
build_matrix: ${{ steps.out.outputs.BUILD_MATRIX }}
4445
steps:
4546
- name: Harden the runner (Audit all outbound calls)
4647
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
@@ -80,22 +81,30 @@ jobs:
8081
NPM_TAG=$(NPM_VERSION=$NPM_VERSION node ./scripts/get-npm-tag.js)
8182
echo "NPM_VERSION=$NPM_VERSION" >> $GITHUB_OUTPUT
8283
echo "NPM_TAG=$NPM_TAG" >> $GITHUB_OUTPUT
83-
echo "Resolved $NPM_VERSION (tag: $NPM_TAG)"
84+
# Target matrix: ios always builds/publishes. visionos is built and
85+
# published ONLY for real releases (a v* tag push, or a manual dispatch
86+
# with a version), never for the rolling "next" channel that every push
87+
# to main produces. The discriminator is the resolved dist-tag: pushes
88+
# to main (and dispatch without a version) -> "next" -> ios only.
89+
if [ "$NPM_TAG" = "next" ]; then
90+
BUILD_MATRIX='{"include":[{"target":"ios","script":"build-ios"}]}'
91+
else
92+
BUILD_MATRIX='{"include":[{"target":"ios","script":"build-ios"},{"target":"visionos","script":"build-vision"}]}'
93+
fi
94+
echo "BUILD_MATRIX=$BUILD_MATRIX" >> $GITHUB_OUTPUT
95+
echo "Resolved $NPM_VERSION (tag: $NPM_TAG); build targets: $BUILD_MATRIX"
8496
8597
build:
8698
name: Build ${{ matrix.target }}
8799
runs-on: macos-14
88100
needs: setup
89101
strategy:
90102
fail-fast: false
91-
matrix:
92-
# `target` is the package identity (artifact names, @nativescript/<target>);
93-
# `script` is the npm script that builds it (note: the vision script is build-vision).
94-
include:
95-
- target: ios
96-
script: build-ios
97-
- target: visionos
98-
script: build-vision
103+
# Computed in `setup`: ios always; visionos only for real releases
104+
# (npm_tag != "next"), never for the rolling "next" channel. Each entry
105+
# carries `target` (package identity, @nativescript/<target>) and `script`
106+
# (the npm build script; note the vision script is build-vision).
107+
matrix: ${{ fromJSON(needs.setup.outputs.build_matrix) }}
99108
env:
100109
NPM_VERSION: ${{ needs.setup.outputs.npm_version }}
101110
steps:
@@ -388,8 +397,10 @@ jobs:
388397
id-token: write
389398
strategy:
390399
fail-fast: false
391-
matrix:
392-
target: [ios, visionos]
400+
# Same targets as the build matrix (computed in `setup`): visionos is
401+
# published only for real releases, never for the "next" channel. The
402+
# unused `script` key on each entry is harmless here.
403+
matrix: ${{ fromJSON(needs.setup.outputs.build_matrix) }}
393404
env:
394405
NPM_VERSION: ${{ needs.setup.outputs.npm_version }}
395406
NPM_TAG: ${{ needs.setup.outputs.npm_tag }}

0 commit comments

Comments
 (0)