Skip to content

Commit e80207f

Browse files
authored
Merge branch 'master' into fix/daemon-idle-cpu-36467
2 parents a3c38f0 + ea0d611 commit e80207f

16 files changed

Lines changed: 279 additions & 69 deletions

File tree

.github/workflows/publish.yml

Lines changed: 179 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,7 @@ jobs:
573573
- resolve-required-data
574574
- build-freebsd
575575
- build
576+
- report-pending-publish
576577
env:
577578
GH_TOKEN: ${{ github.token }}
578579
steps:
@@ -581,6 +582,46 @@ jobs:
581582
repository: ${{ needs.resolve-required-data.outputs.repo || github.repository }}
582583
ref: ${{ needs.resolve-required-data.outputs.ref || github.ref }}
583584

585+
# Built here (rather than inline in the payload below) to keep the Block Kit
586+
# construction consistent with the other two Slack-posting jobs.
587+
- name: Build Slack message payload
588+
id: approved-message
589+
if: ${{ needs.report-pending-publish.outputs.slack_thread_ts }}
590+
env:
591+
THREAD_TS: ${{ needs.report-pending-publish.outputs.slack_thread_ts }}
592+
run: |
593+
PAYLOAD=$(jq -nc --arg ts "$THREAD_TS" '{
594+
channel: "C024JCL7TST",
595+
text: "✅ Publish Approved",
596+
thread_ts: $ts,
597+
attachments: [
598+
{
599+
color: "good",
600+
blocks: [
601+
{
602+
type: "section",
603+
text: { type: "mrkdwn", text: "*Approved* — publishing now." }
604+
}
605+
]
606+
}
607+
]
608+
}')
609+
echo "payload=$PAYLOAD" >> "$GITHUB_OUTPUT"
610+
611+
# Best-effort threaded confirmation that the manual review gate has been passed and the
612+
# publish is proceeding. Requires the SLACK_BOT_TOKEN secret and a valid thread to reply to;
613+
# if either is missing this step no-ops without affecting the actual publish below.
614+
- name: Notify Slack thread that publish was approved
615+
id: notify-approved
616+
if: ${{ needs.report-pending-publish.outputs.slack_thread_ts }}
617+
continue-on-error: true
618+
uses: slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a # v2.1.1
619+
with:
620+
method: chat.postMessage
621+
token: ${{ secrets.SLACK_BOT_TOKEN }}
622+
errors: true
623+
payload: ${{ steps.approved-message.outputs.payload }}
624+
584625
- name: Set verbose logging from debug mode
585626
if: runner.debug == '1'
586627
run: echo "NX_VERBOSE_LOGGING=true" >> "$GITHUB_ENV"
@@ -664,27 +705,148 @@ jobs:
664705
runs-on: ubuntu-latest
665706
timeout-minutes: 10
666707
continue-on-error: true # Don't fail the workflow if notification fails
708+
outputs:
709+
slack_thread_ts: ${{ steps.notify.outputs.ts }}
667710
steps:
711+
# Decide who to mention: pinging the person who triggered the run themselves is
712+
# pointless noise (they already know they're publishing), and mentioning a whole
713+
# group invites the bystander effect where everyone assumes someone else will
714+
# review it. So we mention Jason by default, unless *he* is the triggering actor,
715+
# in which case we mention Craigory and Jack instead.
716+
#
717+
# Jason Jean's GitHub login is `FrozenPandaz` - confirmed via his GitHub profile
718+
# (github.com/FrozenPandaz, which displays "Jason Jean" as the account's real
719+
# name) and cross-checked against his extensive merged-PR history on nrwl/nx.
720+
- name: Determine which reviewers to mention
721+
id: reviewers
722+
env:
723+
TRIGGERING_ACTOR: ${{ github.triggering_actor }}
724+
run: |
725+
if [ "$TRIGGERING_ACTOR" = "FrozenPandaz" ]; then
726+
echo "mentions=<@U020RK8EMRR> <@UD688H84E>" >> "$GITHUB_OUTPUT" # Craigory Coppola + Jack Hsu
727+
else
728+
echo "mentions=<@U9NPA6C90>" >> "$GITHUB_OUTPUT" # Jason Jean
729+
fi
730+
731+
# Built here (rather than inline in the payload below) to avoid fragile nested
732+
# GitHub Actions expressions inside a YAML block, and so the conditional PR/non-PR
733+
# wording stays readable.
734+
- name: Build Slack message payload
735+
id: message
736+
env:
737+
VERSION: ${{ needs.resolve-required-data.outputs.version }}
738+
PR_NUMBER: ${{ needs.resolve-required-data.outputs.pr_number }}
739+
PR_AUTHOR: ${{ needs.resolve-required-data.outputs.pr_author }}
740+
MENTIONS: ${{ steps.reviewers.outputs.mentions }}
741+
RUN_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
742+
run: |
743+
if [ -n "$PR_NUMBER" ]; then
744+
TITLE_TEXT="📦 PR #${PR_NUMBER} Publish Pending Review"
745+
MAIN_TEXT="*Version ${VERSION}* from PR #${PR_NUMBER} by @${PR_AUTHOR} is being published to NPM - manual review is required ${MENTIONS}"
746+
else
747+
TITLE_TEXT="📦 Publish Pending Review"
748+
MAIN_TEXT="*Version ${VERSION}* is being published to NPM - manual review is required ${MENTIONS}"
749+
fi
750+
PAYLOAD=$(jq -nc \
751+
--arg title "$TITLE_TEXT" \
752+
--arg main "$MAIN_TEXT" \
753+
--arg run_url "$RUN_URL" \
754+
'{
755+
channel: "C024JCL7TST",
756+
text: $title,
757+
attachments: [
758+
{
759+
color: "good",
760+
blocks: [
761+
{
762+
type: "section",
763+
text: { type: "mrkdwn", text: $main }
764+
},
765+
{
766+
type: "context",
767+
elements: [
768+
{ type: "mrkdwn", text: ("<" + $run_url + "|View Workflow Run>") }
769+
]
770+
}
771+
]
772+
}
773+
]
774+
}')
775+
echo "payload=$PAYLOAD" >> "$GITHUB_OUTPUT"
776+
777+
# Uses the bot-token based slack-github-action (rather than the incoming-webhook
778+
# based ravsamhq/notify-slack-action used previously) because only a bot token can
779+
# return a message `ts`, which downstream jobs need in order to post threaded
780+
# replies once the publish is approved and once it completes. Requires the
781+
# SLACK_BOT_TOKEN repo secret (a Slack bot token with chat:write + chat:write.public
782+
# scopes); until that secret exists this step - and therefore the whole job, which
783+
# is continue-on-error - fails harmlessly without blocking the publish.
668784
- name: Send Slack notification
669-
uses: ravsamhq/notify-slack-action@be814b201e233b2dc673608aa46e5447c8ab13f2 # v11
785+
id: notify
786+
uses: slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a # v2.1.1
670787
with:
671-
status: ${{ job.status }}
672-
notification_title: >-
673-
${{ needs.resolve-required-data.outputs.pr_number &&
674-
format('📦 PR #{0} Publish Pending Review', needs.resolve-required-data.outputs.pr_number) ||
675-
'📦 Publish Pending Review' }}
676-
message_format: >-
677-
${{ needs.resolve-required-data.outputs.pr_number &&
678-
format('Version {0} from PR #{1} by @{2} is being published to NPM - manual review is required',
679-
needs.resolve-required-data.outputs.version,
680-
needs.resolve-required-data.outputs.pr_number,
681-
needs.resolve-required-data.outputs.pr_author) ||
682-
format('Version {0} is being published to NPM - manual review is required',
683-
needs.resolve-required-data.outputs.version) }}
684-
footer: '<{run_url}|View Workflow Run>'
685-
mention_users: 'U9NPA6C90' # Jason
788+
method: chat.postMessage
789+
token: ${{ secrets.SLACK_BOT_TOKEN }}
790+
errors: true
791+
payload: ${{ steps.message.outputs.payload }}
792+
793+
report-published:
794+
name: Report Successful Publish to Slack
795+
if: ${{ github.repository_owner == 'nrwl' }}
796+
needs:
797+
- resolve-required-data
798+
- publish
799+
- report-pending-publish
800+
runs-on: ubuntu-latest
801+
timeout-minutes: 10
802+
continue-on-error: true # Don't fail the workflow if notification fails
803+
steps:
804+
# Only fires once `publish` has actually succeeded - if `publish` fails, GitHub
805+
# skips this job by default since it's a listed `needs` dependency that didn't succeed.
806+
- name: Build Slack message payload
807+
id: message
686808
env:
687-
SLACK_WEBHOOK_URL: ${{ secrets.ACTION_MONITORING_SLACK }}
809+
VERSION: ${{ needs.resolve-required-data.outputs.version }}
810+
THREAD_TS: ${{ needs.report-pending-publish.outputs.slack_thread_ts }}
811+
RUN_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
812+
run: |
813+
MAIN_TEXT="*Version ${VERSION}* was published to NPM successfully."
814+
PAYLOAD=$(jq -nc \
815+
--arg main "$MAIN_TEXT" \
816+
--arg ts "$THREAD_TS" \
817+
--arg run_url "$RUN_URL" \
818+
'{
819+
channel: "C024JCL7TST",
820+
text: "🎉 Published Successfully",
821+
thread_ts: $ts,
822+
attachments: [
823+
{
824+
color: "good",
825+
blocks: [
826+
{
827+
type: "section",
828+
text: { type: "mrkdwn", text: $main }
829+
},
830+
{
831+
type: "context",
832+
elements: [
833+
{ type: "mrkdwn", text: ("<" + $run_url + "|View Workflow Run>") }
834+
]
835+
}
836+
]
837+
}
838+
]
839+
}')
840+
echo "payload=$PAYLOAD" >> "$GITHUB_OUTPUT"
841+
842+
- name: Send Slack notification
843+
if: ${{ needs.report-pending-publish.outputs.slack_thread_ts }}
844+
uses: slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a # v2.1.1
845+
with:
846+
method: chat.postMessage
847+
token: ${{ secrets.SLACK_BOT_TOKEN }}
848+
errors: true
849+
payload: ${{ steps.message.outputs.payload }}
688850

689851
pr_failure_comment:
690852
# Run this job if it is a PR release, running on the nrwl origin, and any of the required jobs failed

astro-docs/src/content/docs/technologies/build-tools/docker/introduction.mdoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,15 @@ Configure `buildTarget` and `runTarget` as objects to pass custom arguments, set
9999

100100
When using the object format, the following properties are available:
101101

102-
- **`name`** (string, required): The name of the inferred target
102+
- **`name`** (string, required): The name of the task
103103
- **`args`** (string[], optional): Additional arguments to pass to the Docker command. Supports pattern interpolation.
104104
- **`env`** (object, optional): Environment variables to set when running the Docker command. Values support pattern interpolation.
105105
- **`envFile`** (string, optional): Path to an environment file to load
106106
- **`cwd`** (string, optional): Working directory for the command. Supports pattern interpolation.
107107
- **`configurations`** (object, optional): Named Nx configurations that override `args`, `env`, `envFile`, `cwd`, or `skipDefaultTag`.
108108
- **`skipDefaultTag`** (boolean, default `false`): Do not add the default Nx `--tag` argument to build commands. Supply a tag in `args`; opting out also disables Nx Release versioning and publishing for that Docker project.
109109

110-
The build task depends on the project's `build` task and dependency builds. The run task depends on the inferred Docker build task. Nx also adds an `nx-release-publish` target that uses the `@nx/docker:release-publish` executor.
110+
The build task depends on the project's `build` task and dependency builds. The run task depends on the Docker build task. Nx also adds an `nx-release-publish` task for publishing images with [Nx Release](/docs/features/manage-releases).
111111

112112
#### Pattern interpolation
113113

astro-docs/src/content/docs/technologies/build-tools/rollup/introduction.mdoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ The `@nx/rollup/plugin` plugin looks for these Rollup configuration files:
4848
- `rollup.config.cts`
4949
- `rollup.config.mts`
5050

51-
A configuration file is associated with a project when its directory also contains a `package.json` or `project.json`. Nx reads the Rollup outputs and creates a cached build task that runs `rollup -c`, depends on the same task in dependency projects, and records the configured output paths for cache restoration.
51+
A configuration file is associated with a project when its directory also contains a `package.json` or `project.json`. Nx creates a cached build task that runs `rollup -c`, with outputs based on your Rollup configuration, and depends on the same task in dependency projects.
5252

5353
Configure the plugin in `nx.json`:
5454

astro-docs/src/content/docs/technologies/build-tools/rspack/introduction.mdoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ The `@nx/rspack/plugin` is configured in the `plugins` array in `nx.json`.
9595
| `buildDepsTargetName` | none | Name of an optional dependency build task. |
9696
| `watchDepsTargetName` | none | Name of an optional dependency watch task. |
9797

98-
The build target depends on builds of project dependencies. When TypeScript project references are enabled, the inferred targets also run the TypeScript sync generator.
98+
The build task depends on builds of project dependencies. When TypeScript project references are enabled, the tasks also run the TypeScript sync generator.
9999

100100
Use `include` and `exclude` glob patterns on the plugin entry to scope inference. A [target defaults](/docs/reference/nx-json#target-defaults) `plugin` filter must use the exact identifier `@nx/rspack/plugin`.
101101

astro-docs/src/content/docs/technologies/build-tools/vite/introduction.mdoc

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ filter: 'type:References'
99

1010
[Vite](https://vite.dev/) is a fast build tool and dev server for modern web apps. In a Vite monorepo, Nx runs and caches Vite tasks across every project so you only rebuild what changed.
1111

12-
The `@nx/vite` plugin adds [inferred targets](#configuration) and [project configuration generators](#setup).
12+
The `@nx/vite` plugin adds [inferred tasks](#configuration) and [project configuration generators](#setup).
1313

1414
{% aside type="note" title="Vitest is now in @nx/vitest" %}
1515
Starting with Nx v22, Vitest support has moved to the dedicated [`@nx/vitest` plugin](/docs/technologies/test-tools/vitest/introduction). In Nx v21 and prior, `@nx/vite` contained what is now in `@nx/vitest`. If you are upgrading, see the [migration guide](/docs/kb/migrating-from-nx-vite).
@@ -106,16 +106,16 @@ The `@nx/vite` plugin infers tasks by reading Vite config files. Any of the foll
106106

107107
The configuration directory must also contain a `package.json` or `project.json`.
108108

109-
Build targets are only created when the project is buildable. A project is treated as buildable when any of the following are true:
109+
Build tasks are only created when the project is buildable. A project is treated as buildable when any of the following are true:
110110

111111
- `build.lib` is set in `vite.config.*`
112112
- `build.rollupOptions.input` or `build.rolldownOptions.input` is set (Vite 8 uses `rolldownOptions`)
113113
- `builder.buildApp` is set
114114
- an `index.html` file exists at the project root
115115

116-
Dev, preview, and serve-static targets are created for buildable projects. If you are in library mode (`build.lib`), these targets are skipped unless you explicitly configure a dev server (e.g. `server.host` or `server.port`).
116+
Dev, preview, and serve-static tasks are created for buildable projects. If you are in library mode (`build.lib`), these tasks are skipped unless you explicitly configure a dev server (e.g. `server.host` or `server.port`).
117117

118-
Typecheck targets are created when a `tsconfig*.json` file exists in the project.
118+
Typecheck tasks are created when a `tsconfig*.json` file exists in the project.
119119

120120
### Plugin options
121121

@@ -143,24 +143,22 @@ Configure `@nx/vite/plugin` in the `plugins` array in `nx.json`:
143143
}
144144
```
145145

146-
`serveTargetName` is deprecated; use `devTargetName` instead. `buildDepsTargetName` and `watchDepsTargetName` create targets that build or watch project dependencies.
147-
148-
| Option | Description | Default |
149-
| ----------------------- | ---------------------------------------------------- | -------------- |
150-
| `buildTargetName` | Name of the Vite build target | `build` |
151-
| `previewTargetName` | Name of the Vite preview target | `preview` |
152-
| `serveTargetName` | Name of the deprecated Vite serve target | `serve` |
153-
| `devTargetName` | Name of the Vite dev server target | `dev` |
154-
| `serveStaticTargetName` | Name of the static file server target | `serve-static` |
155-
| `typecheckTargetName` | Name of the typecheck target | `typecheck` |
156-
| `compiler` | Typecheck compiler: `tsc`, `tsgo`, or `vue-tsc` | auto-detected |
157-
| `buildDepsTargetName` | Name of the build-deps target for dependency builds | none |
158-
| `watchDepsTargetName` | Name of the watch-deps target for dependency watches | none |
159-
160-
Build and typecheck tasks are cached.
161-
Build tasks declare the resolved Vite build output directory.
162-
Typecheck tasks do not declare cache outputs.
163-
Development, preview, and static-server tasks are continuous.
146+
`serveTargetName` is deprecated; use `devTargetName` instead. `buildDepsTargetName` and `watchDepsTargetName` create tasks that build or watch project dependencies.
147+
148+
| Option | Description | Default |
149+
| ----------------------- | -------------------------------------------------- | -------------- |
150+
| `buildTargetName` | Name of the Vite build task | `build` |
151+
| `previewTargetName` | Name of the Vite preview task | `preview` |
152+
| `serveTargetName` | Name of the deprecated Vite serve task | `serve` |
153+
| `devTargetName` | Name of the Vite dev server task | `dev` |
154+
| `serveStaticTargetName` | Name of the static file server task | `serve-static` |
155+
| `typecheckTargetName` | Name of the typecheck task | `typecheck` |
156+
| `compiler` | Typecheck compiler: `tsc`, `tsgo`, or `vue-tsc` | auto-detected |
157+
| `buildDepsTargetName` | Name of the build-deps task for dependency builds | none |
158+
| `watchDepsTargetName` | Name of the watch-deps task for dependency watches | none |
159+
160+
The build and typecheck tasks are cached, with build outputs based on your Vite configuration.
161+
The dev, preview, and static-server tasks are continuous.
164162
When `compiler` is omitted, Nx uses `vue-tsc` when it detects a Vite Vue plugin and `tsc` otherwise.
165163

166164
### Disable or scope inference

astro-docs/src/content/docs/technologies/build-tools/webpack/introduction.mdoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ The `@nx/webpack/plugin` is configured in the `plugins` array in `nx.json`.
102102
| `buildDepsTargetName` | `build-deps` | Name of the dependency build task. |
103103
| `watchDepsTargetName` | `watch-deps` | Name of the dependency watch task. |
104104

105-
The build target depends on builds of project dependencies. When TypeScript project references are enabled, the inferred targets also run the TypeScript sync generator.
105+
The build task depends on builds of project dependencies. When TypeScript project references are enabled, the tasks also run the TypeScript sync generator.
106106

107107
Use `include` and `exclude` glob patterns on the plugin entry to scope inference. A [target defaults](/docs/reference/nx-json#target-defaults) `plugin` filter must use the exact identifier `@nx/webpack/plugin`.
108108

0 commit comments

Comments
 (0)