Skip to content

Commit 034f2c9

Browse files
committed
chore: configure ci
1 parent d765190 commit 034f2c9

File tree

4 files changed

+31
-39
lines changed

4 files changed

+31
-39
lines changed

.github/workflows/cd.yml

+11-15
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
11
name: Release
22

33
on:
4-
- workflow_dispatch
4+
push:
5+
tags:
6+
- v*.*.*
7+
workflow_run:
8+
59

610
jobs:
711
release:
812
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
id-token: write # needed for provenance data generation
916

1017
if: github.ref == 'refs/heads/main'
1118

1219
steps:
13-
- uses: actions/checkout@v3
20+
- uses: actions/checkout@v4
1421
- name: Setup
1522
uses: ./.github/actions/setup
1623
with:
@@ -21,20 +28,9 @@ jobs:
2128
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
2229
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2330
GH_TOKEN: ${{ secrets.GH_TOKEN }}
31+
NPM_CONFIG_PROVENANCE: true
2432
# Use npx instead of yarn because yarn automagically sets NPM_* environment variables
2533
# like NPM_CONFIG_REGISTRY so npm publish ends up ignoring the .npmrc file
2634
# which is set up by `setup-node` action.
2735
shell: bash
28-
run: npx nx affected --base=last-release --target=version
29-
30-
- name: Tag last-release
31-
shell: bash
32-
run: git tag -f last-release
33-
34-
- name: Push changes
35-
uses: ad-m/github-push-action@master
36-
with:
37-
github_token: ${{ secrets.GH_TOKEN }}
38-
branch: ${{ github.ref }}
39-
force: true
40-
tags: true
36+
run: npx nx release publish

nx.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,10 @@
8484
"projects": ["nx-cloudflare"],
8585
"projectsRelationship": "independent",
8686
"version": {
87-
"conventionalCommits": true
87+
"conventionalCommits": true,
88+
"generatorOptions": {
89+
"updateDependents": true
90+
}
8891
},
8992
"git": {
9093
"commit": true,

packages/nx-cloudflare/project.json

-17
Original file line numberDiff line numberDiff line change
@@ -36,23 +36,6 @@
3636
}
3737
]
3838
}
39-
},
40-
"github": {
41-
"executor": "@jscutlery/semver:github",
42-
"options": {
43-
"tag": "${tag}",
44-
"notes": "${notes}"
45-
}
46-
},
47-
"npm-publish": {
48-
"executor": "ngx-deploy-npm:deploy",
49-
"options": {
50-
"access": "public"
51-
}
52-
},
53-
"publish": {
54-
"command": "node tools/scripts/publish.mjs nx-cloudflare {args.ver} {args.tag}",
55-
"dependsOn": ["build"]
5639
}
5740
}
5841
}

tools/scripts/start-local-registry.ts

+16-6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55
import { startLocalRegistry } from '@nx/js/plugins/jest/local-registry';
66
import { execFileSync } from 'child_process';
7+
import { releasePublish, releaseVersion } from 'nx/release';
78

89
export default async () => {
910
// local registry target to run
@@ -16,10 +17,19 @@ export default async () => {
1617
storage,
1718
verbose: false,
1819
});
19-
const nx = require.resolve('nx');
20-
execFileSync(
21-
nx,
22-
['run-many', '--targets', 'publish', '--ver', '0.0.0-e2e', '--tag', 'e2e'],
23-
{ env: process.env, stdio: 'inherit' }
24-
);
20+
21+
await releaseVersion({
22+
specifier: '0.0.0-e2e',
23+
stageChanges: false,
24+
gitCommit: false,
25+
gitTag: false,
26+
firstRelease: true,
27+
generatorOptionsOverrides: {
28+
skipLockFileUpdate: true,
29+
},
30+
});
31+
await releasePublish({
32+
tag: 'e2e',
33+
firstRelease: true,
34+
});
2535
};

0 commit comments

Comments
 (0)