Skip to content

Commit 12a4f2a

Browse files
committed
chore(repo): ensure first release gets set for changelog creation
1 parent 8e2a44a commit 12a4f2a

File tree

6 files changed

+103
-35
lines changed

6 files changed

+103
-35
lines changed

.github/workflows/release.yml

+20-1
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,17 @@ jobs:
4040
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
4141
NPM_CONFIG_PROVENANCE: true
4242
GH_TOKEN: ${{ github.token }}
43-
4443
steps:
4544
- name: Checkout
4645
uses: actions/checkout@v4
4746
with:
4847
fetch-depth: 0
48+
fetch-tags: 'true'
49+
50+
- name: Configure Git User
51+
run: |
52+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
53+
git config --global user.name "github-actions[bot]"
4954
5055
- name: Setup pnpm
5156
uses: pnpm/action-setup@v4
@@ -55,10 +60,24 @@ jobs:
5560
uses: actions/setup-node@v4
5661
with:
5762
node-version: 20.12
63+
registry-url: 'https://registry.npmjs.org'
5864
cache: 'pnpm'
5965

66+
# Ensure that the NPM_TOKEN secret is still valid before wasting any time deriving data or building projects
67+
- name: Check NPM Credentials
68+
run: npm whoami && echo "NPM credentials are valid" || (echo "NPM credentials are invalid or have expired." && exit 1)
69+
env:
70+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
71+
NPM_CONFIG_PROVENANCE: true
72+
GH_TOKEN: ${{ github.token }}
73+
74+
6075
- name: Install dependencies
6176
run: pnpm install --frozen-lockfile
6277

6378
- name: Release packages
6479
run: pnpm release --version ${{ github.event.inputs.specifier }} --dist-tag ${{ github.event.inputs.dist-tag }} --dry-run=${{ github.event.inputs.dry-run }} --first-release=${{ github.event.inputs.first-release }}
80+
env:
81+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
82+
NPM_CONFIG_PROVENANCE: true
83+
GH_TOKEN: ${{ github.token }}

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
"sass": "^1.79.3",
7676
"sass-embedded": "^1.79.3",
7777
"sass-loader": "^16.0.2",
78+
"semver": "^7.5.3",
7879
"tcp-port-used": "^1.0.2",
7980
"ts-morph": "^24.0.0",
8081
"ts-node": "10.9.1",

packages/angular-rsbuild/package.json

+29-18
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,39 @@
11
{
22
"name": "@nx/angular-rsbuild",
3+
"version": "19.0.0-alpha.29",
4+
"description": "Rsbuild Plugin for building Angular.",
5+
"private": false,
6+
"publishConfig": {
7+
"access": "public"
8+
},
9+
"author": "Colum Ferry",
10+
"license": "MIT",
11+
"bugs": {
12+
"url": "https://github.com/nrwl/angular-rspack/issues"
13+
},
14+
"repository": {
15+
"type": "git",
16+
"url": "https://github.com/nrwl/angular-rspack.git",
17+
"directory": "packages/angular-rsbuild"
18+
},
319
"keywords": [
420
"angular",
521
"rsbuild",
622
"rsbuild-plugin"
723
],
8-
"version": "19.0.0-alpha.29",
24+
"type": "commonjs",
25+
"main": "./dist/index.js",
26+
"typings": "./dist/index.d.ts",
27+
"exports": {
28+
".": {
29+
"types": "./dist/index.d.ts",
30+
"default": "./dist/index.js"
31+
},
32+
"./ssr": {
33+
"types": "./dist/lib/ssr/server.d.ts",
34+
"default": "./dist/lib/ssr/server.js"
35+
}
36+
},
937
"dependencies": {
1038
"@nx/angular-rspack-compiler": "workspace:*",
1139
"@rsbuild/plugin-less": "^1.1.1",
@@ -24,23 +52,6 @@
2452
"@angular/ssr": ">=19.0.0 <20.0.0",
2553
"@rsbuild/core": ">=1.0.5 <2.0.0"
2654
},
27-
"type": "commonjs",
28-
"main": "./dist/index.js",
29-
"typings": "./dist/index.d.ts",
30-
"exports": {
31-
".": {
32-
"types": "./dist/index.d.ts",
33-
"default": "./dist/index.js"
34-
},
35-
"./ssr": {
36-
"types": "./dist/lib/ssr/server.d.ts",
37-
"default": "./dist/lib/ssr/server.js"
38-
}
39-
},
40-
"private": false,
41-
"publishConfig": {
42-
"access": "public"
43-
},
4455
"nx": {
4556
"sourceRoot": "packages/angular-rsbuild/src",
4657
"projectType": "library",

packages/rsbuild-plugin-angular/package.json

+11
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@
66
"rsbuild-plugin"
77
],
88
"version": "19.0.0-alpha.29",
9+
"description": "Rsbuild Plugin for building Angular.",
10+
"author": "Colum Ferry",
11+
"license": "MIT",
12+
"bugs": {
13+
"url": "https://github.com/nrwl/angular-rspack/issues"
14+
},
15+
"repository": {
16+
"type": "git",
17+
"url": "https://github.com/nrwl/angular-rspack.git",
18+
"directory": "packages/rsbuild-plugin-angular"
19+
},
920
"dependencies": {
1021
"@ng-rspack/compiler": "workspace:*",
1122
"sass-embedded": "^1.79.3",

pnpm-lock.yaml

+14-11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tools/scripts/release.ts

+28-5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,29 @@ import {
44
releasePublish,
55
} from 'nx/src/command-line/release';
66
import yargs from 'yargs';
7+
import { parse } from 'semver';
8+
9+
export function deriveDistTagFromSpecifier(distTag: string, specifier: string) {
10+
// dist-tag was explicitly set
11+
if (distTag && distTag !== 'infer-from-specifier') {
12+
return distTag;
13+
}
14+
15+
// Derive dist-tag from specifier
16+
if (
17+
specifier.startsWith('pre') ||
18+
specifier.includes('-alpha') ||
19+
specifier.includes('-beta')
20+
) {
21+
return 'next';
22+
}
23+
24+
if (parse(specifier)?.prerelease.length) {
25+
return 'next';
26+
}
27+
28+
return 'latest';
29+
}
730

831
(async () => {
932
try {
@@ -46,7 +69,7 @@ import yargs from 'yargs';
4669
specifier: options.version,
4770
// stage package.json updates to be committed later by the changelog command
4871
stageChanges: true,
49-
dryRun: true,
72+
dryRun: options.dryRun,
5073
verbose: options.verbose,
5174
});
5275

@@ -56,15 +79,15 @@ import yargs from 'yargs';
5679
gitTag: true,
5780
versionData: projectsVersionData,
5881
version: workspaceVersion,
59-
interactive: 'workspace',
60-
dryRun: true,
82+
dryRun: options.dryRun,
6183
verbose: options.verbose,
84+
firstRelease: options.firstRelease,
6285
});
6386

6487
await releasePublish({
6588
firstRelease: options.firstRelease,
66-
tag: options.distTag,
67-
dryRun: true,
89+
tag: deriveDistTagFromSpecifier(options.distTag, options.version),
90+
dryRun: options.dryRun,
6891
verbose: options.verbose,
6992
});
7093

0 commit comments

Comments
 (0)