Skip to content

Commit b0c82e6

Browse files
committed
Revert publish (#26544)
<!-- Please make sure you have read the submission guidelines before posting an PR --> <!-- https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr --> <!-- Please make sure that your commit message follows our format --> <!-- Example: `fix(nx): must begin with lowercase` --> <!-- If this is a particularly complex change or feature addition, you can request a dedicated Nx release for this pull request branch. Mention someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they will confirm if the PR warrants its own release for testing purposes, and generate it for you if appropriate. --> ## Current Behavior <!-- This is the behavior we have today --> The below commit caused the publish pipeline to publish a `minor` version when it should have been a `next` version. ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> This reverts commit 3750366. ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes # (cherry picked from commit 73c8c33)
1 parent 92c94d8 commit b0c82e6

File tree

5 files changed

+82
-458
lines changed

5 files changed

+82
-458
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
<!-- Please make sure that your commit message follows our format -->
55
<!-- Example: `fix(nx): must begin with lowercase` -->
66

7-
<!-- If this is a particularly complex change or feature addition, you can request a dedicated Nx release for this pull request branch. Mention someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they will confirm if the PR warrants its own release for testing purposes, and generate it for you if appropriate. -->
8-
97
## Current Behavior
108
<!-- This is the behavior we have today -->
119

.github/workflows/publish.yml

Lines changed: 31 additions & 199 deletions
Original file line numberDiff line numberDiff line change
@@ -1,122 +1,19 @@
11
name: publish
22

33
on:
4-
# Automated schedule - canary releases from master
54
schedule:
65
- cron: "0 3 * * 2-6" # Tuesdays - Saturdays, at 3am UTC
7-
# Manual trigger - PR releases or dry-runs (based on workflow inputs)
86
workflow_dispatch:
9-
inputs:
10-
pr:
11-
description: "PR Number - If set, a real release will be created for the branch associated with the given PR number. If blank, a dry-run of the currently selected branch will be performed."
12-
required: false
13-
type: number
147
release:
158
types: [ published ]
169

17-
# Dynamically generate the display name for the GitHub UI based on the event type and inputs
18-
run-name: ${{ github.event.inputs.pr && format('PR Release for {0}', github.event.inputs.pr) || github.event_name == 'schedule' && 'Canary Release' || github.event_name == 'workflow_dispatch' && !github.event.inputs.pr && 'Release Dry-Run' || github.ref_name }}
19-
2010
env:
2111
DEBUG: napi:*
2212
NX_RUN_GROUP: ${{ github.run_id }}-${{ github.run_attempt }}
2313
CYPRESS_INSTALL_BINARY: 0
24-
NODE_VERSION: 18
25-
PNPM_VERSION: 8.15.7 # Aligned with root package.json (pnpm/action-setup will helpfully error if out of sync)
2614

2715
jobs:
28-
# We first need to determine the version we are releasing, and if we need a custom repo or ref to use for the git checkout in subsequent steps.
29-
# These values depend upon the event type that triggered the workflow:
30-
#
31-
# - schedule:
32-
# - We are running a canary release which always comes from the master branch, we can use default ref resolution
33-
# in actions/checkout. The exact version will be generated within scripts/nx-release.ts.
34-
#
35-
# - release:
36-
# - We are running a full release which is based on the tag that triggered the release event, we can use default
37-
# ref resolution in actions/checkout. The exact version will be generated within scripts/nx-release.ts.
38-
#
39-
# - workflow_dispatch:
40-
# - We are either running a dry-run on the current branch, in which case the version will be statica and we can use
41-
# default ref resolution in actions/checkout, or we are creating a PR release for the given PR number, in which case
42-
# we should generate an applicable version number within publish-resolve-data.js and use a custom ref of the PR branch name.
43-
resolve-required-data:
44-
name: Resolve Required Data
45-
if: ${{ github.repository_owner == 'nrwl' }}
46-
runs-on: ubuntu-latest
47-
outputs:
48-
version: ${{ steps.script.outputs.version }}
49-
dry_run_flag: ${{ steps.script.outputs.dry_run_flag }}
50-
success_comment: ${{ steps.script.outputs.success_comment }}
51-
publish_branch: ${{ steps.script.outputs.publish_branch }}
52-
ref: ${{ steps.script.outputs.ref }}
53-
repo: ${{ steps.script.outputs.repo }}
54-
env:
55-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
56-
steps:
57-
# Default checkout on the triggering branch so that the latest publish-resolve-data.js script is available
58-
- uses: actions/checkout@v4
59-
60-
# Set up pnpm and node so that we can verify our setup and that the NPM_TOKEN secret will work later
61-
- uses: pnpm/action-setup@v4
62-
with:
63-
version: ${{ env.PNPM_VERSION }}
64-
65-
- name: Setup node
66-
uses: actions/setup-node@v4
67-
with:
68-
node-version: ${{ env.NODE_VERSION }}
69-
registry-url: 'https://registry.npmjs.org'
70-
check-latest: true
71-
cache: 'pnpm'
72-
73-
# Ensure that the NPM_TOKEN secret is still valid before wasting any time deriving data or building projects
74-
- name: Check NPM Credentials
75-
run: npm whoami && echo "NPM credentials are valid" || (echo "NPM credentials are invalid or have expired." && exit 1)
76-
77-
- name: Resolve and set checkout and version data to use for release
78-
id: script
79-
uses: actions/github-script@v7
80-
env:
81-
PR_NUMBER: ${{ github.event.inputs.pr }}
82-
with:
83-
github-token: ${{ secrets.GITHUB_TOKEN }}
84-
script: |
85-
const script = require('${{ github.workspace }}/scripts/publish-resolve-data.js');
86-
await script({ github, context, core });
87-
88-
- name: (PR Release Only) Check out latest master
89-
if: ${{ steps.script.outputs.ref != '' }}
90-
uses: actions/checkout@v4
91-
with:
92-
# Check out the latest master branch to get its copy of nx-release.ts
93-
repository: nrwl/nx
94-
ref: master
95-
path: latest-master-checkout
96-
97-
- name: (PR Release Only) Check out PR branch
98-
if: ${{ steps.script.outputs.ref != '' }}
99-
uses: actions/checkout@v4
100-
with:
101-
# Check out the PR branch to get its copy of nx-release.ts
102-
repository: ${{ steps.script.outputs.repo }}
103-
ref: ${{ steps.script.outputs.ref }}
104-
path: pr-branch-checkout
105-
106-
- name: (PR Release Only) Ensure that nx-release.ts has not changed in the PR being released
107-
if: ${{ steps.script.outputs.ref != '' }}
108-
env:
109-
FILE_TO_COMPARE: "scripts/nx-release.ts"
110-
run: |
111-
if ! cmp -s "latest-master-checkout/${{ env.FILE_TO_COMPARE }}" "pr-branch-checkout/${{ env.FILE_TO_COMPARE }}"; then
112-
echo "🛑 Error: The file ${{ env.FILE_TO_COMPARE }} is different on the ${{ steps.script.outputs.ref }} branch on ${{ steps.script.outputs.repo }} vs latest master on nrwl/nx, cancelling workflow. If you did not modify the file, then you likely just need to rebase/merge latest master."
113-
exit 1
114-
else
115-
echo "✅ The file ${{ env.FILE_TO_COMPARE }} is identical between the ${{ steps.script.outputs.ref }} branch on ${{ steps.script.outputs.repo }} and latest master on nrwl/nx."
116-
fi
117-
11816
build:
119-
needs: [resolve-required-data]
12017
if: ${{ github.repository_owner == 'nrwl' }}
12118
strategy:
12219
fail-fast: false
@@ -203,19 +100,16 @@ jobs:
203100
runs-on: ${{ matrix.settings.host }}
204101
steps:
205102
- uses: actions/checkout@v4
206-
with:
207-
repository: ${{ needs.resolve-required-data.outputs.repo }}
208-
ref: ${{ needs.resolve-required-data.outputs.ref }}
209103

210-
- uses: pnpm/action-setup@v4
104+
- uses: pnpm/action-setup@v2
211105
with:
212-
version: ${{ env.PNPM_VERSION }}
106+
version: 8
213107

214108
- name: Setup node
215109
uses: actions/setup-node@v4
216110
if: ${{ !matrix.settings.docker }}
217111
with:
218-
node-version: ${{ env.NODE_VERSION }}
112+
node-version: 18
219113
check-latest: true
220114
cache: 'pnpm'
221115

@@ -226,7 +120,7 @@ jobs:
226120
targets: ${{ matrix.settings.target }}
227121

228122
- name: Cache cargo
229-
uses: actions/cache@v4
123+
uses: actions/cache@v3
230124
with:
231125
path: |
232126
~/.cargo/registry/index/
@@ -235,72 +129,59 @@ jobs:
235129
.cargo-cache
236130
target/
237131
key: ${{ matrix.settings.target }}-cargo-registry
238-
239132
- uses: goto-bus-stop/setup-zig@v2
240133
if: ${{ matrix.settings.target == 'armv7-unknown-linux-gnueabihf' }}
241134
with:
242135
version: 0.10.0
243-
244136
- name: Setup toolchain
245137
run: ${{ matrix.settings.setup }}
246138
if: ${{ matrix.settings.setup }}
247139
shell: bash
248-
249140
- name: Setup node x86
250141
if: matrix.settings.target == 'i686-pc-windows-msvc'
251142
run: yarn config set supportedArchitectures.cpu "ia32"
252143
shell: bash
253-
254144
- name: Install dependencies
255145
if: ${{ !matrix.settings.docker }}
256146
run: pnpm install --frozen-lockfile
257147
timeout-minutes: 30
258-
259148
- name: Setup node x86
260149
uses: actions/setup-node@v4
261150
if: matrix.settings.target == 'i686-pc-windows-msvc'
262151
with:
263-
node-version: ${{ env.NODE_VERSION }}
152+
node-version: 18
264153
check-latest: true
265154
cache: pnpm
266155
architecture: x86
267-
268156
- name: Build in docker
269157
uses: addnab/docker-run-action@v3
270158
if: ${{ matrix.settings.docker }}
271159
with:
272160
image: ${{ matrix.settings.docker }}
273161
options: --user 0:0 -v ${{ github.workspace }}/.cargo-cache/git/db:/usr/local/cargo/git/db -v ${{ github.workspace }}/.cargo/registry/cache:/usr/local/cargo/registry/cache -v ${{ github.workspace }}/.cargo/registry/index:/usr/local/cargo/registry/index -v ${{ github.workspace }}:/build -w /build
274162
run: ${{ matrix.settings.build }}
275-
276163
- name: Build
277164
run: ${{ matrix.settings.build }}
278165
if: ${{ !matrix.settings.docker }}
279166
shell: bash
280-
281167
- name: Upload artifact
282-
uses: actions/upload-artifact@v4
168+
uses: actions/upload-artifact@v3
283169
with:
284170
name: bindings-${{ matrix.settings.target }}
285171
path: packages/**/*.node
286172
if-no-files-found: error
287173

288174
build-freebsd:
289-
needs: [resolve-required-data]
290175
if: ${{ github.repository_owner == 'nrwl' }}
291176
runs-on: macos-13-large
292177
name: Build FreeBSD
293178
timeout-minutes: 45
294179
steps:
295180
- uses: actions/checkout@v4
296-
if: ${{ github.event_name != 'schedule' && !github.event.inputs.pr }}
297-
with:
298-
repository: ${{ needs.resolve-required-data.outputs.repo }}
299-
ref: ${{ needs.resolve-required-data.outputs.ref }}
300-
181+
if: ${{ github.event_name != 'schedule' }}
301182
- name: Build
302183
id: build
303-
if: ${{ github.event_name != 'schedule' && !github.event.inputs.pr }}
184+
if: ${{ github.event_name != 'schedule' }}
304185
uses: cross-platform-actions/[email protected]
305186
env:
306187
DEBUG: napi:*
@@ -342,10 +223,9 @@ jobs:
342223
echo "KILL ALL NODE PROCESSES"
343224
killall node || true
344225
echo "COMPLETE"
345-
346226
- name: Upload artifact
347-
if: ${{ github.event_name != 'schedule' && !github.event.inputs.pr }}
348-
uses: actions/upload-artifact@v4
227+
if: ${{ github.event_name != 'schedule' }}
228+
uses: actions/upload-artifact@v3
349229
with:
350230
name: bindings-freebsd
351231
path: packages/**/*.node
@@ -358,9 +238,7 @@ jobs:
358238
permissions:
359239
id-token: write
360240
contents: write
361-
pull-requests: write
362241
needs:
363-
- resolve-required-data
364242
- build-freebsd
365243
- build
366244
env:
@@ -369,91 +247,45 @@ jobs:
369247
NPM_CONFIG_PROVENANCE: true
370248
steps:
371249
- uses: actions/checkout@v4
250+
- uses: pnpm/action-setup@v2
372251
with:
373-
repository: ${{ needs.resolve-required-data.outputs.repo }}
374-
ref: ${{ needs.resolve-required-data.outputs.ref }}
375-
376-
- uses: pnpm/action-setup@v4
377-
with:
378-
version: ${{ env.PNPM_VERSION }}
379-
252+
version: 8
380253
- name: Setup node
381254
uses: actions/setup-node@v4
382255
with:
383-
node-version: ${{ env.NODE_VERSION }}
256+
node-version: 18
384257
registry-url: 'https://registry.npmjs.org'
385258
check-latest: true
386259
cache: 'pnpm'
387-
260+
- name: Check NPM Credentials
261+
run: npm whoami && echo "NPM credentials are valid" || (echo "NPM credentials are invalid or have expired." && exit 1)
388262
- name: Install dependencies
389263
run: pnpm install --frozen-lockfile
390-
391264
- name: Download all artifacts
392-
uses: actions/download-artifact@v4
265+
uses: actions/download-artifact@v3
393266
with:
394267
path: artifacts
395-
396-
# This command will appropriately fail if no artifacts are available
397268
- name: List artifacts
398269
run: ls -R artifacts
399270
shell: bash
400-
401271
- name: Publish
402-
env:
403-
VERSION: ${{ needs.resolve-required-data.outputs.version }}
404-
DRY_RUN: ${{ needs.resolve-required-data.outputs.dry_run_flag }}
405-
PUBLISH_BRANCH: ${{ needs.resolve-required-data.outputs.publish_branch }}
406272
run: |
407-
echo ""
408-
# Create and check out the publish branch
409-
git checkout -b $PUBLISH_BRANCH
410-
echo ""
411-
echo "Version set to: $VERSION"
412-
echo "DRY_RUN set to: $DRY_RUN"
413-
echo ""
273+
git checkout -b publish/$GITHUB_REF_NAME
274+
# If triggered by the cron, create a canary release
275+
if [ "${{ github.event_name }}" = "schedule" ]; then
276+
VERSION="canary"
277+
else
278+
# Otherwise, use the tag name (if triggered via release), or explicit version (if triggered via workflow_dispatch)
279+
VERSION="${GITHUB_REF_NAME}"
280+
fi
281+
# If triggered via workflow_dispatch, perform a dry-run
282+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
283+
DRY_RUN="--dry-run"
284+
else
285+
DRY_RUN=""
286+
fi
414287
pnpm nx-release --local=false $VERSION $DRY_RUN
415-
416288
- name: (Stable Release Only) Trigger Docs Release
289+
# Publish docs only on a full release
417290
if: ${{ !github.event.release.prerelease && github.event_name == 'release' }}
418291
run: npx ts-node ./scripts/release-docs.ts
419-
420-
- name: (PR Release Only) Create comment for successful PR release
421-
if: success() && github.event.inputs.pr
422-
uses: actions/github-script@v7
423-
env:
424-
SUCCESS_COMMENT: ${{ needs.resolve-required-data.outputs.success_comment }}
425-
with:
426-
github-token: ${{ secrets.GITHUB_TOKEN }}
427-
script: |
428-
const successComment = JSON.parse(process.env.SUCCESS_COMMENT);
429-
await github.rest.issues.createComment({
430-
owner: context.repo.owner,
431-
repo: context.repo.repo,
432-
issue_number: ${{ github.event.inputs.pr }},
433-
body: successComment
434-
});
435-
436-
pr_failure_comment:
437-
# Run this job if it is a PR release, running on the nrwl origin, and any of the required jobs failed
438-
if: ${{ github.repository_owner == 'nrwl' && github.event.inputs.pr && always() && contains(needs.*.result, 'failure') }}
439-
needs: [resolve-required-data, build, build-freebsd, publish]
440-
name: (PR Release Failure Only) Create comment for failed PR release
441-
runs-on: ubuntu-latest
442-
steps:
443-
- name: Create comment for failed PR release
444-
uses: actions/github-script@v7
445-
with:
446-
github-token: ${{ secrets.GITHUB_TOKEN }}
447-
# This script is intentionally kept inline (and e.g. not generated in publish-resolve-data.js)
448-
# to ensure that an error within the data generation itself is not missed.
449-
script: |
450-
const message = `
451-
Failed to publish a PR release of this pull request, triggered by @${{ github.triggering_actor }}.
452-
See the failed workflow run at: https://github.com/nrwl/nx/actions/runs/${{ github.run_id }}
453-
`;
454-
await github.rest.issues.createComment({
455-
owner: context.repo.owner,
456-
repo: context.repo.repo,
457-
issue_number: ${{ github.event.inputs.pr }},
458-
body: message
459-
});

CONTRIBUTING.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,3 @@ Closes #157
355355
To simplify and automate the process of committing with this format,
356356
**Nx is a [Commitizen](https://github.com/commitizen/cz-cli) friendly repository**, just do `git add` and
357357
execute `pnpm commit`.
358-
359-
#### PR releases
360-
361-
If you are working on a particularly complex change or feature addition, you can request a dedicated Nx release for the associated pull request branch. Mention someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they will confirm if the PR warrants its own release for testing purposes, and generate it for you if appropriate.

0 commit comments

Comments
 (0)