|
53 | 53 | if: github.repository_owner == 'PyModel' |
54 | 54 | outputs: |
55 | 55 | packages_published: ${{ steps.changesets.outputs.published }} |
| 56 | + extension_version_bumped: ${{ steps.extension-version.outputs.bumped }} |
56 | 57 | pythinker_native_release: ${{ steps.pythinker-release.outputs.should_publish }} |
57 | 58 | pythinker_release_tag: ${{ steps.pythinker-release.outputs.tag }} |
58 | 59 | permissions: |
|
78 | 79 | - name: Upgrade npm for Trusted Publishing |
79 | 80 | run: npm install -g npm@11 |
80 | 81 |
|
| 82 | + # Machine-readable signal for the VS Code extension publish gate: the |
| 83 | + # release PR merge is a squash whose only meaningful delta for the |
| 84 | + # extension is the version field, so compare it against the previous |
| 85 | + # commit instead of trusting the commit-message prefix. |
| 86 | + - name: Detect extension version bump |
| 87 | + id: extension-version |
| 88 | + run: | |
| 89 | + prev=$(git show 'HEAD^:apps/vscode/package.json' | node -p 'JSON.parse(require("fs").readFileSync(0, "utf8")).version') |
| 90 | + curr=$(node -p 'require("./apps/vscode/package.json").version') |
| 91 | + if [ "$prev" = "$curr" ]; then bumped=false; else bumped=true; fi |
| 92 | + echo "bumped=$bumped" >> "$GITHUB_OUTPUT" |
| 93 | +
|
81 | 94 | - name: Install dependencies |
82 | 95 | run: pnpm install --frozen-lockfile |
83 | 96 |
|
@@ -134,15 +147,17 @@ jobs: |
134 | 147 | # version but never publishes it to npm, so it ships from here instead. Both |
135 | 148 | # publish scripts skip packages that already exist in the registry, so this |
136 | 149 | # job is a no-op on releases that did not touch the extension. Extension-only |
137 | | - # releases publish nothing to npm, so also run on release-PR merges. |
| 150 | + # releases publish nothing to npm, so the gate also covers a version bump. |
138 | 151 | publish-vscode-extension: |
139 | 152 | timeout-minutes: 45 |
140 | 153 | name: Publish VS Code extension |
141 | 154 | needs: release |
142 | 155 | if: >- |
143 | 156 | needs.release.outputs.packages_published == 'true' |
144 | | - || startsWith(github.event.head_commit.message, 'ci: release packages') |
| 157 | + || needs.release.outputs.extension_version_bumped == 'true' |
145 | 158 | runs-on: ubuntu-latest |
| 159 | + permissions: |
| 160 | + contents: read |
146 | 161 | steps: |
147 | 162 | - name: Checkout |
148 | 163 | uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # pinned from v6.0.2 |
|
0 commit comments