|
41 | 41 | outputs: |
42 | 42 | npm_version: ${{ steps.out.outputs.NPM_VERSION }} |
43 | 43 | npm_tag: ${{ steps.out.outputs.NPM_TAG }} |
| 44 | + build_matrix: ${{ steps.out.outputs.BUILD_MATRIX }} |
44 | 45 | steps: |
45 | 46 | - name: Harden the runner (Audit all outbound calls) |
46 | 47 | uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4 |
@@ -80,22 +81,30 @@ jobs: |
80 | 81 | NPM_TAG=$(NPM_VERSION=$NPM_VERSION node ./scripts/get-npm-tag.js) |
81 | 82 | echo "NPM_VERSION=$NPM_VERSION" >> $GITHUB_OUTPUT |
82 | 83 | 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" |
84 | 96 |
|
85 | 97 | build: |
86 | 98 | name: Build ${{ matrix.target }} |
87 | 99 | runs-on: macos-14 |
88 | 100 | needs: setup |
89 | 101 | strategy: |
90 | 102 | 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) }} |
99 | 108 | env: |
100 | 109 | NPM_VERSION: ${{ needs.setup.outputs.npm_version }} |
101 | 110 | steps: |
@@ -388,8 +397,10 @@ jobs: |
388 | 397 | id-token: write |
389 | 398 | strategy: |
390 | 399 | 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) }} |
393 | 404 | env: |
394 | 405 | NPM_VERSION: ${{ needs.setup.outputs.npm_version }} |
395 | 406 | NPM_TAG: ${{ needs.setup.outputs.npm_tag }} |
|
0 commit comments