@npmcli/template-oss 4.19.0 → 4.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/README.md +35 -11
  2. package/bin/release-manager.js +23 -271
  3. package/bin/release-please.js +20 -55
  4. package/lib/config.js +98 -119
  5. package/lib/content/{_job-matrix.yml → _job-matrix-yml.hbs} +1 -1
  6. package/lib/content/_job-release-integration-yml.hbs +51 -0
  7. package/lib/content/{_job.yml → _job-yml.hbs} +1 -1
  8. package/lib/content/_step-node-yml.hbs +15 -0
  9. package/lib/content/_steps-setup-yml.hbs +15 -0
  10. package/lib/content/action-create-check-yml.hbs +50 -0
  11. package/lib/content/action-install-latest-npm-yml.hbs +55 -0
  12. package/lib/content/{audit.yml → audit-yml.hbs} +2 -2
  13. package/lib/content/ci-release-yml.hbs +49 -0
  14. package/lib/content/ci-yml.hbs +13 -0
  15. package/lib/content/{codeql-analysis.yml → codeql-analysis-yml.hbs} +1 -1
  16. package/lib/content/{eslintrc.js → eslintrc-js.hbs} +11 -1
  17. package/lib/content/{gitignore → gitignore.hbs} +2 -0
  18. package/lib/content/index.js +55 -40
  19. package/lib/content/{pkg.json → package-json.hbs} +19 -5
  20. package/lib/content/{post-dependabot.yml → post-dependabot-yml.hbs} +1 -1
  21. package/lib/content/{pull-request.yml → pull-request-yml.hbs} +3 -5
  22. package/lib/content/release-integration-yml.hbs +24 -0
  23. package/lib/content/release-please-config-json.hbs +23 -0
  24. package/lib/content/release-yml.hbs +245 -0
  25. package/lib/content/tsconfig-json.hbs +17 -0
  26. package/lib/release/changelog.js +184 -0
  27. package/lib/release/node-workspace-format.js +107 -0
  28. package/lib/release/node-workspace.js +95 -0
  29. package/lib/release/release-manager.js +287 -0
  30. package/lib/release/release-please.js +180 -0
  31. package/lib/release/util.js +42 -0
  32. package/lib/util/files.js +29 -20
  33. package/lib/util/get-cmd-path.js +36 -0
  34. package/lib/util/git.js +6 -2
  35. package/lib/util/import-or-require.js +29 -0
  36. package/lib/util/parser.js +6 -1
  37. package/lib/util/path.js +13 -0
  38. package/lib/util/template.js +9 -6
  39. package/package.json +21 -13
  40. package/lib/content/_job-release-integration.yml +0 -59
  41. package/lib/content/_step-checks.yml +0 -54
  42. package/lib/content/_step-node.yml +0 -57
  43. package/lib/content/_steps-setup.yml +0 -6
  44. package/lib/content/ci-release.yml +0 -37
  45. package/lib/content/ci.yml +0 -13
  46. package/lib/content/release-please-config.json +0 -13
  47. package/lib/content/release.yml +0 -217
  48. package/lib/release-please/changelog.js +0 -92
  49. package/lib/release-please/github.js +0 -72
  50. package/lib/release-please/index.js +0 -262
  51. package/lib/release-please/node-workspace.js +0 -192
  52. package/lib/release-please/util.js +0 -14
  53. package/lib/release-please/version.js +0 -103
  54. /package/lib/content/{CODEOWNERS → CODEOWNERS.hbs} +0 -0
  55. /package/lib/content/{CODE_OF_CONDUCT.md → CODE_OF_CONDUCT-md.hbs} +0 -0
  56. /package/lib/content/{CONTRIBUTING.md → CONTRIBUTING-md.hbs} +0 -0
  57. /package/lib/content/{LICENSE.md → LICENSE-md.hbs} +0 -0
  58. /package/lib/content/{SECURITY.md → SECURITY-md.hbs} +0 -0
  59. /package/lib/content/{_on-ci.yml → _on-ci-yml.hbs} +0 -0
  60. /package/lib/content/{_step-audit.yml → _step-audit-yml.hbs} +0 -0
  61. /package/lib/content/{_step-deps.yml → _step-deps-yml.hbs} +0 -0
  62. /package/lib/content/{_step-git.yml → _step-git-yml.hbs} +0 -0
  63. /package/lib/content/{_step-lint.yml → _step-lint-yml.hbs} +0 -0
  64. /package/lib/content/{_step-test.yml → _step-test-yml.hbs} +0 -0
  65. /package/lib/content/{bug.yml → bug-yml.hbs} +0 -0
  66. /package/lib/content/{commitlintrc.js → commitlintrc-js.hbs} +0 -0
  67. /package/lib/content/{config.yml → config-yml.hbs} +0 -0
  68. /package/lib/content/{dependabot.yml → dependabot-yml.hbs} +0 -0
  69. /package/lib/content/{npmrc → npmrc.hbs} +0 -0
  70. /package/lib/content/{release-please-manifest.json → release-please-manifest-json.hbs} +0 -0
  71. /package/lib/content/{settings.yml → settings-yml.hbs} +0 -0
  72. /package/lib/content/{tap.json → tap-json.hbs} +0 -0
@@ -5,48 +5,56 @@ const isPublic = (p) => p.config.isPublic
5
5
  const sharedRootAdd = (name) => ({
6
6
  // release
7
7
  '.github/workflows/release.yml': {
8
- file: 'release.yml',
8
+ file: 'release-yml.hbs',
9
9
  filter: isPublic,
10
10
  },
11
11
  '.github/workflows/ci-release.yml': {
12
- file: 'ci-release.yml',
12
+ file: 'ci-release-yml.hbs',
13
+ filter: isPublic,
14
+ },
15
+ '.github/workflows/release-integration.yml': {
16
+ file: 'release-integration-yml.hbs',
13
17
  filter: isPublic,
14
18
  },
15
19
  '.release-please-manifest.json': {
16
- file: 'release-please-manifest.json',
20
+ file: 'release-please-manifest-json.hbs',
17
21
  filter: isPublic,
18
- parser: (p) => class extends p.JsonMerge {
19
- comment = null
20
- },
22
+ parser: (p) => p.JsonMergeNoComment,
21
23
  },
22
24
  'release-please-config.json': {
23
- file: 'release-please-config.json',
25
+ file: 'release-please-config-json.hbs',
24
26
  filter: isPublic,
25
- parser: (p) => class extends p.JsonMerge {
26
- comment = null
27
- },
27
+ parser: (p) => p.JsonMergeNoComment,
28
+ },
29
+ 'tsconfig.json': {
30
+ file: 'tsconfig-json.hbs',
31
+ filter: (p) => p.config.typescript,
32
+ parser: (p) => p.JsonMergeNoComment,
28
33
  },
29
34
  // this lint commits which is only necessary for releases
30
35
  '.github/workflows/pull-request.yml': {
31
- file: 'pull-request.yml',
36
+ file: 'pull-request-yml.hbs',
32
37
  filter: isPublic,
33
38
  },
34
39
  // ci
35
- '.github/matchers/tap.json': 'tap.json',
36
- [`.github/workflows/ci${name ? `-${name}` : ''}.yml`]: 'ci.yml',
40
+ '.github/matchers/tap.json': 'tap-json.hbs',
41
+ [`.github/workflows/ci${name ? `-${name}` : ''}.yml`]: 'ci-yml.hbs',
37
42
  // dependabot
38
43
  '.github/dependabot.yml': {
39
- file: 'dependabot.yml',
44
+ file: 'dependabot-yml.hbs',
40
45
  filter: (p) => p.config.dependabot,
41
46
  },
42
47
  '.github/workflows/post-dependabot.yml': {
43
- file: 'post-dependabot.yml',
48
+ file: 'post-dependabot-yml.hbs',
44
49
  filter: (p) => p.config.dependabot,
45
50
  },
46
51
  '.github/settings.yml': {
47
- file: 'settings.yml',
52
+ file: 'settings-yml.hbs',
48
53
  filter: (p) => !p.config.isReleaseBranch,
49
54
  },
55
+ // composite actions
56
+ '.github/actions/install-latest-npm/action.yml': 'action-install-latest-npm-yml.hbs',
57
+ '.github/actions/create-check/action.yml': 'action-create-check-yml.hbs',
50
58
  })
51
59
 
52
60
  const sharedRootRm = () => ({
@@ -61,15 +69,16 @@ const sharedRootRm = () => ({
61
69
  // Changes applied to the root of the repo
62
70
  const rootRepo = {
63
71
  add: {
64
- '.commitlintrc.js': 'commitlintrc.js',
65
- '.github/ISSUE_TEMPLATE/bug.yml': 'bug.yml',
66
- '.github/ISSUE_TEMPLATE/config.yml': 'config.yml',
67
- '.github/CODEOWNERS': 'CODEOWNERS',
68
- '.github/workflows/audit.yml': 'audit.yml',
69
- '.github/workflows/codeql-analysis.yml': 'codeql-analysis.yml',
72
+ '.commitlintrc.{{ cjsExt }}': 'commitlintrc-js.hbs',
73
+ '.github/ISSUE_TEMPLATE/bug.yml': 'bug-yml.hbs',
74
+ '.github/ISSUE_TEMPLATE/config.yml': 'config-yml.hbs',
75
+ '.github/CODEOWNERS': 'CODEOWNERS.hbs',
76
+ '.github/workflows/audit.yml': 'audit-yml.hbs',
77
+ '.github/workflows/codeql-analysis.yml': 'codeql-analysis-yml.hbs',
70
78
  ...sharedRootAdd(),
71
79
  },
72
80
  rm: {
81
+ '.commitlintrc.{{ deleteJsExt }}': true,
73
82
  '.github/workflows/release-test.yml': true,
74
83
  '.github/workflows/release-please.yml': true,
75
84
  ...sharedRootRm(),
@@ -83,19 +92,19 @@ const rootRepo = {
83
92
  // dir. so we might want to combine these
84
93
  const rootModule = {
85
94
  add: {
86
- '.eslintrc.js': {
87
- file: 'eslintrc.js',
95
+ '.eslintrc.{{ cjsExt }}': {
96
+ file: 'eslintrc-js.hbs',
88
97
  filter: (p) => p.config.eslint,
89
98
  },
90
- '.gitignore': 'gitignore',
91
- '.npmrc': 'npmrc',
92
- 'SECURITY.md': 'SECURITY.md',
93
- 'CODE_OF_CONDUCT.md': 'CODE_OF_CONDUCT.md',
94
- 'CONTRIBUTING.md': 'CONTRIBUTING.md',
95
- 'package.json': 'pkg.json',
99
+ '.gitignore': 'gitignore.hbs',
100
+ '.npmrc': 'npmrc.hbs',
101
+ 'SECURITY.md': 'SECURITY-md.hbs',
102
+ 'CODE_OF_CONDUCT.md': 'CODE_OF_CONDUCT-md.hbs',
103
+ 'CONTRIBUTING.md': 'CONTRIBUTING-md.hbs',
104
+ 'package.json': 'package-json.hbs',
96
105
  },
97
106
  rm: [
98
- '.eslintrc.!(js|local.*)',
107
+ '.eslintrc.!({{ cjsExt }}|local.*)',
99
108
  ],
100
109
  }
101
110
 
@@ -114,16 +123,16 @@ const workspaceRepo = {
114
123
  // Changes for each workspace but applied to the relative workspace dir
115
124
  const workspaceModule = {
116
125
  add: {
117
- '.eslintrc.js': {
118
- file: 'eslintrc.js',
126
+ '.eslintrc.{{ cjsExt }}': {
127
+ file: 'eslintrc-js.hbs',
119
128
  filter: (p) => p.config.eslint,
120
129
  },
121
- '.gitignore': 'gitignore',
122
- 'package.json': 'pkg.json',
130
+ '.gitignore': 'gitignore.hbs',
131
+ 'package.json': 'package-json.hbs',
123
132
  },
124
133
  rm: [
125
134
  '.npmrc',
126
- '.eslintrc.!(js|local.*)',
135
+ '.eslintrc.!({{ cjsExt }}|local.*)',
127
136
  'SECURITY.md',
128
137
  ],
129
138
  }
@@ -138,14 +147,16 @@ module.exports = {
138
147
  branches: ['main', 'latest'],
139
148
  // set this to the major version to backport
140
149
  backport: null,
150
+ // this tag will be used for publishing when not prerelease or backport. use
151
+ // {{major}} to have the major version being published replaced in the string.
152
+ defaultPublishTag: 'latest',
141
153
  releaseBranch: 'release/v*',
142
154
  distPaths: [
143
155
  'bin/',
144
156
  'lib/',
145
157
  ],
158
+ allowDistPaths: true,
146
159
  allowPaths: [
147
- '/bin/',
148
- '/lib/',
149
160
  '/.eslintrc.local.*',
150
161
  '**/.gitignore',
151
162
  '/docs/',
@@ -157,13 +168,17 @@ module.exports = {
157
168
  '/LICENSE*',
158
169
  '/CHANGELOG*',
159
170
  ],
160
- ignorePaths: [],
171
+ ignorePaths: [
172
+ /* to be provided by consuming package */
173
+ ],
161
174
  ciVersions: {},
162
175
  latestCiVersion: 20,
163
176
  lockfile: false,
164
177
  codeowner: '@npm/cli-team',
165
178
  eslint: true,
166
179
  publish: false,
180
+ typescript: false,
181
+ esm: false,
167
182
  updateNpm: true,
168
183
  dependabot: 'increase-if-necessary',
169
184
  unwantedPackages: [
@@ -188,6 +203,6 @@ module.exports = {
188
203
  { type: 'fix', section: 'Bug Fixes', hidden: false },
189
204
  { type: 'docs', section: 'Documentation', hidden: false },
190
205
  { type: 'deps', section: 'Dependencies', hidden: false },
191
- { type: 'chore', hidden: true },
206
+ { type: 'chore', section: 'Chores', hidden: false },
192
207
  ],
193
208
  }
@@ -1,18 +1,22 @@
1
1
  {
2
2
  "author": "GitHub Inc.",
3
3
  "files": {{{ json distPaths }}},
4
+ "type": {{#if esm}}"module"{{else}}{{{ del }}}{{/if}},
4
5
  "scripts": {
5
- "lint": "{{#if eslint}}eslint \"**/*.js\"{{else}}echo linting disabled{{/if}}",
6
+ "lint": "{{#if eslint}}eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"{{else}}echo linting disabled{{/if}}",
6
7
  "postlint": "template-oss-check",
7
8
  "template-oss-apply": "template-oss-apply --force",
8
9
  "lintfix": "{{ localNpmPath }} run lint -- --fix",
9
- "snap": "tap",
10
- "test": "tap",
10
+ "snap": "{{#if typescript}}{{#if tap16}}c8 {{/if}}{{/if}}tap",
11
+ "test": "{{#if typescript}}{{#if tap16}}c8 {{/if}}{{/if}}tap",
11
12
  "posttest": "{{ localNpmPath }} run lint",
12
13
  {{#if isRootMono}}
13
14
  "test-all": "{{ localNpmPath }} run test {{ allFlags }}",
14
15
  "lint-all": "{{ localNpmPath }} run lint {{ allFlags }}",
15
16
  {{/if}}
17
+ {{#if typescript}}
18
+ "prepare": "tshy",
19
+ {{/if}}
16
20
  "template-copy": {{{ del }}},
17
21
  "lint:fix": {{{ del }}},
18
22
  "preversion": {{{ del }}},
@@ -30,13 +34,23 @@
30
34
  {{#if workspacePaths}}
31
35
  "test-ignore": "^({{ join workspacePaths "|" }})/",
32
36
  {{/if}}
33
- "nyc-arg": [
37
+ {{#if typescript}}
38
+ {{#if tap16}}
39
+ "coverage": false,
40
+ "node-arg": [
41
+ "--no-warnings",
42
+ "--loader",
43
+ "ts-node/esm"
44
+ ],
45
+ {{/if}}
46
+ {{/if}}
47
+ "nyc-arg": {{#if tap18}}{{{ del }}}{{else}}[
34
48
  {{#each workspaceGlobs}}
35
49
  "--exclude",
36
50
  "{{ . }}",
37
51
  {{/each}}
38
52
  "--exclude",
39
53
  "tap-snapshots/**"
40
- ]
54
+ ]{{/if}}
41
55
  }
42
56
  }
@@ -8,7 +8,7 @@ permissions:
8
8
 
9
9
  jobs:
10
10
  template-oss:
11
- {{> job
11
+ {{> jobYml
12
12
  jobName="template-oss"
13
13
  jobIf="github.actor == 'dependabot[bot]'"
14
14
  jobCheckout=(obj ref="${{ github.event.pull_request.head.ref }}")
@@ -10,15 +10,13 @@ on:
10
10
 
11
11
  jobs:
12
12
  commitlint:
13
- {{> job jobName="Lint Commits" jobCheckout=(obj fetch-depth=0) }}
13
+ {{> jobYml jobName="Lint Commits" jobCheckout=(obj fetch-depth=0) }}
14
14
  - name: Run Commitlint on Commits
15
15
  id: commit
16
16
  continue-on-error: true
17
- run: |
18
- {{ rootNpxPath }} --offline commitlint -V --from 'origin/$\{{ github.base_ref }}' --to $\{{ github.event.pull_request.head.sha }}
17
+ run: {{ rootNpxPath }} --offline commitlint -V --from 'origin/$\{{ github.base_ref }}' --to $\{{ github.event.pull_request.head.sha }}
19
18
  - name: Run Commitlint on PR Title
20
19
  if: steps.commit.outcome == 'failure'
21
20
  env:
22
21
  PR_TITLE: $\{{ github.event.pull_request.title }}
23
- run: |
24
- echo "$PR_TITLE" | {{ rootNpxPath }} --offline commitlint -V
22
+ run: echo "$PR_TITLE" | {{ rootNpxPath }} --offline commitlint -V
@@ -0,0 +1,24 @@
1
+ name: Release Integration
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ releases:
7
+ required: true
8
+ type: string
9
+ description: 'A json array of releases. Required fields: publish: tagName, publishTag. publish check: pkgName, version'
10
+ workflow_call:
11
+ inputs:
12
+ releases:
13
+ required: true
14
+ type: string
15
+ description: 'A json array of releases. Required fields: publish: tagName, publishTag. publish check: pkgName, version'
16
+ {{#if publish}}
17
+ secrets:
18
+ PUBLISH_TOKEN:
19
+ required: true
20
+ {{/if}}
21
+
22
+ jobs:
23
+ publish:
24
+ {{> jobReleaseIntegrationYml }}
@@ -0,0 +1,23 @@
1
+ {
2
+ "separate-pull-requests": {{{ del }}},
3
+ {{#if isMonoPublic }}
4
+ "plugins": [
5
+ "node-workspace",
6
+ "node-workspace-format"
7
+ ],
8
+ {{/if}}
9
+ "exclude-packages-from-root": {{{ del }}},
10
+ "group-pull-request-title-pattern": "chore: release ${version}",
11
+ "pull-request-title-pattern": "chore: release${component} ${version}",
12
+ "changelog-sections": {{{ json changelogTypes }}},
13
+ "prerelease-type": "pre",
14
+ "packages": {
15
+ "{{ pkgPath }}": {
16
+ {{#if isRoot}}
17
+ "package-name": ""{{#if workspacePaths}},
18
+ "exclude-paths": {{{ json workspacePaths }}}
19
+ {{/if}}
20
+ {{/if}}
21
+ }
22
+ }
23
+ }
@@ -0,0 +1,245 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ {{#each branchPatterns}}
7
+ - {{ . }}
8
+ {{/each}}
9
+
10
+ permissions:
11
+ contents: write
12
+ pull-requests: write
13
+ checks: write
14
+
15
+ jobs:
16
+ release:
17
+ outputs:
18
+ pr: $\{{ steps.release.outputs.pr }}
19
+ pr-branch: $\{{ steps.release.outputs.pr-branch }}
20
+ pr-number: $\{{ steps.release.outputs.pr-number }}
21
+ pr-sha: $\{{ steps.release.outputs.pr-sha }}
22
+ releases: $\{{ steps.release.outputs.releases }}
23
+ comment-id: $\{{ steps.create-comment.outputs.comment-id || steps.update-comment.outputs.comment-id }}
24
+ check-id: $\{{ steps.create-check.outputs.check-id }}
25
+ {{> jobYml jobName="Release" }}
26
+ - name: Release Please
27
+ id: release
28
+ env:
29
+ GITHUB_TOKEN: $\{{ secrets.GITHUB_TOKEN }}
30
+ run: {{ rootNpxPath }} --offline template-oss-release-please --branch="$\{{ github.ref_name }}" --backport="{{ backport }}" --defaultTag="{{ defaultPublishTag }}"
31
+ - name: Create Release Manager Comment Text
32
+ if: steps.release.outputs.pr-number
33
+ uses: actions/github-script@v6
34
+ id: comment-text
35
+ with:
36
+ result-encoding: string
37
+ script: |
38
+ const { runId, repo: { owner, repo } } = context
39
+ const { data: workflow } = await github.rest.actions.getWorkflowRun({ owner, repo, run_id: runId })
40
+ return['## Release Manager', `Release workflow run: ${workflow.html_url}`].join('\n\n')
41
+ - name: Find Release Manager Comment
42
+ uses: peter-evans/find-comment@v2
43
+ if: steps.release.outputs.pr-number
44
+ id: found-comment
45
+ with:
46
+ issue-number: $\{{ steps.release.outputs.pr-number }}
47
+ comment-author: 'github-actions[bot]'
48
+ body-includes: '## Release Manager'
49
+ - name: Create Release Manager Comment
50
+ id: create-comment
51
+ if: steps.release.outputs.pr-number && !steps.found-comment.outputs.comment-id
52
+ uses: peter-evans/create-or-update-comment@v3
53
+ with:
54
+ issue-number: $\{{ steps.release.outputs.pr-number }}
55
+ body: $\{{ steps.comment-text.outputs.result }}
56
+ - name: Update Release Manager Comment
57
+ id: update-comment
58
+ if: steps.release.outputs.pr-number && steps.found-comment.outputs.comment-id
59
+ uses: peter-evans/create-or-update-comment@v3
60
+ with:
61
+ comment-id: $\{{ steps.found-comment.outputs.comment-id }}
62
+ body: $\{{ steps.comment-text.outputs.result }}
63
+ edit-mode: 'replace'
64
+ - name: Create Check
65
+ id: create-check
66
+ uses: ./.github/actions/create-check
67
+ if: steps.release.outputs.pr-sha
68
+ with:
69
+ name: "Release"
70
+ token: $\{{ secrets.GITHUB_TOKEN }}
71
+ sha: $\{{ steps.release.outputs.pr-sha }}
72
+
73
+ update:
74
+ needs: release
75
+ outputs:
76
+ sha: $\{{ steps.commit.outputs.sha }}
77
+ check-id: $\{{ steps.create-check.outputs.check-id }}
78
+ {{> jobYml
79
+ jobName="Update - Release"
80
+ jobIf="needs.release.outputs.pr"
81
+ jobCheckout=(obj ref="${{ needs.release.outputs.pr-branch }}" fetch-depth=0)
82
+ }}
83
+ - name: Create Release Manager Checklist Text
84
+ id: comment-text
85
+ env:
86
+ GITHUB_TOKEN: $\{{ secrets.GITHUB_TOKEN }}
87
+ run: {{ rootNpmPath }} exec --offline -- template-oss-release-manager --pr="$\{{ needs.release.outputs.pr-number }}" --backport="{{ backport }}" --defaultTag="{{ defaultPublishTag }}" {{~#if lockfile}} --lockfile{{/if}} {{~#if publish}} --publish{{/if}}
88
+ - name: Append Release Manager Comment
89
+ uses: peter-evans/create-or-update-comment@v3
90
+ with:
91
+ comment-id: $\{{ needs.release.outputs.comment-id }}
92
+ body: $\{{ steps.comment-text.outputs.result }}
93
+ edit-mode: 'append'
94
+ - name: Run Post Pull Request Actions
95
+ env:
96
+ GITHUB_TOKEN: $\{{ secrets.GITHUB_TOKEN }}
97
+ run: {{ rootNpmPath }} run rp-pull-request --ignore-scripts {{~#if allFlags}} {{ allFlags }}{{else}} --if-present{{/if}} -- --pr="$\{{ needs.release.outputs.pr-number }}" --commentId="$\{{ needs.release.outputs.comment-id }}"
98
+ - name: Commit
99
+ id: commit
100
+ env:
101
+ GITHUB_TOKEN: $\{{ secrets.GITHUB_TOKEN }}
102
+ run: |
103
+ git commit --all --amend --no-edit || true
104
+ git push --force-with-lease
105
+ echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
106
+ - name: Create Check
107
+ id: create-check
108
+ uses: ./.github/actions/create-check
109
+ with:
110
+ name: "Update - Release"
111
+ check-name: "Release"
112
+ token: $\{{ secrets.GITHUB_TOKEN }}
113
+ sha: $\{{ steps.commit.outputs.sha }}
114
+ - name: Conclude Check
115
+ uses: LouisBrunner/checks-action@v1.6.0
116
+ with:
117
+ token: $\{{ secrets.GITHUB_TOKEN }}
118
+ conclusion: $\{{ job.status }}
119
+ check_id: $\{{ needs.release.outputs.check-id }}
120
+
121
+ ci:
122
+ name: CI - Release
123
+ needs: [release, update]
124
+ if: needs.release.outputs.pr
125
+ uses: ./.github/workflows/ci-release.yml
126
+ with:
127
+ ref: $\{{ needs.release.outputs.pr-branch }}
128
+ check-sha: $\{{ needs.update.outputs.sha }}
129
+
130
+ post-ci:
131
+ needs: [release, update, ci]
132
+ {{> jobYml jobName="Post CI - Release" jobIf="needs.release.outputs.pr && always()" jobSkipSetup=true }}
133
+ - name: Get CI Conclusion
134
+ id: conclusion
135
+ run: |
136
+ result=""
137
+ if [[ "$\{{ contains(needs.*.result, 'failure') }}" == "true" ]]; then
138
+ result="failure"
139
+ elif [[ "$\{{ contains(needs.*.result, 'cancelled') }}" == "true" ]]; then
140
+ result="cancelled"
141
+ else
142
+ result="success"
143
+ fi
144
+ echo "result=$result" >> $GITHUB_OUTPUT
145
+ - name: Conclude Check
146
+ uses: LouisBrunner/checks-action@v1.6.0
147
+ with:
148
+ token: $\{{ secrets.GITHUB_TOKEN }}
149
+ conclusion: $\{{ steps.conclusion.outputs.result }}
150
+ check_id: $\{{ needs.update.outputs.check-id }}
151
+
152
+ post-release:
153
+ needs: release
154
+ outputs:
155
+ comment-id: $\{{ steps.create-comment.outputs.comment-id }}
156
+ {{> jobYml jobName="Post Release - Release" jobIf="needs.release.outputs.releases" jobSkipSetup=true }}
157
+ - name: Create Release PR Comment Text
158
+ id: comment-text
159
+ uses: actions/github-script@v6
160
+ env:
161
+ RELEASES: $\{{ needs.release.outputs.releases }}
162
+ with:
163
+ result-encoding: string
164
+ script: |
165
+ const releases = JSON.parse(process.env.RELEASES)
166
+ const { runId, repo: { owner, repo } } = context
167
+ const issue_number = releases[0].prNumber
168
+ const runUrl = `https://github.com/${owner}/${repo}/actions/runs/${runId}`
169
+
170
+ return [
171
+ '## Release Workflow\n',
172
+ ...releases.map(r => `- \`${r.pkgName}@${r.version}\` ${r.url}`),
173
+ `- Workflow run: :arrows_counterclockwise: ${runUrl}`,
174
+ ].join('\n')
175
+ - name: Create Release PR Comment
176
+ id: create-comment
177
+ uses: peter-evans/create-or-update-comment@v3
178
+ with:
179
+ issue-number: $\{{ fromJSON(needs.release.outputs.releases)[0].prNumber }}
180
+ body: $\{{ steps.comment-text.outputs.result }}
181
+
182
+ release-integration:
183
+ needs: release
184
+ name: Release Integration
185
+ if: needs.release.outputs.releases
186
+ uses: ./.github/workflows/release-integration.yml
187
+ {{#if publish}}
188
+ permissions:
189
+ id-token: write
190
+ secrets:
191
+ PUBLISH_TOKEN: $\{{ secrets.PUBLISH_TOKEN }}
192
+ {{/if}}
193
+ with:
194
+ releases: $\{{ needs.release.outputs.releases }}
195
+
196
+ post-release-integration:
197
+ needs: [release, release-integration, post-release]
198
+ {{> jobYml jobName="Post Release Integration - Release" jobIf="needs.release.outputs.releases && always()" jobSkipSetup=true }}
199
+ - name: Get Post Release Conclusion
200
+ id: conclusion
201
+ run: |
202
+ if [[ "$\{{ contains(needs.*.result, 'failure') }}" == "true" ]]; then
203
+ result="x"
204
+ elif [[ "$\{{ contains(needs.*.result, 'cancelled') }}" == "true" ]]; then
205
+ result="heavy_multiplication_x"
206
+ else
207
+ result="white_check_mark"
208
+ fi
209
+ echo "result=$result" >> $GITHUB_OUTPUT
210
+ - name: Find Release PR Comment
211
+ uses: peter-evans/find-comment@v2
212
+ id: found-comment
213
+ with:
214
+ issue-number: $\{{ fromJSON(needs.release.outputs.releases)[0].prNumber }}
215
+ comment-author: 'github-actions[bot]'
216
+ body-includes: '## Release Workflow'
217
+ - name: Create Release PR Comment Text
218
+ id: comment-text
219
+ if: steps.found-comment.outputs.comment-id
220
+ uses: actions/github-script@v6
221
+ env:
222
+ RESULT: $\{{ steps.conclusion.outputs.result }}
223
+ BODY: $\{{ steps.found-comment.outputs.comment-body }}
224
+ with:
225
+ result-encoding: string
226
+ script: |
227
+ const { RESULT, BODY } = process.env
228
+ const body = [BODY.replace(/(Workflow run: :)[a-z_]+(:)/, `$1${RESULT}$2`)]
229
+ if (RESULT !== 'white_check_mark') {
230
+ body.push(':rotating_light::rotating_light::rotating_light:')
231
+ body.push([
232
+ '{{ codeowner }}: The post-release workflow failed for this release.',
233
+ 'Manual steps may need to be taken after examining the workflow output.'
234
+ ].join(' '))
235
+ body.push(':rotating_light::rotating_light::rotating_light:')
236
+ }
237
+ return body.join('\n\n').trim()
238
+ - name: Update Release PR Comment
239
+ if: steps.comment-text.outputs.result
240
+ uses: peter-evans/create-or-update-comment@v3
241
+ with:
242
+ comment-id: $\{{ steps.found-comment.outputs.comment-id }}
243
+ body: $\{{ steps.comment-text.outputs.result }}
244
+ edit-mode: 'replace'
245
+
@@ -0,0 +1,17 @@
1
+ {
2
+ "compilerOptions": {
3
+ "jsx": "react",
4
+ "declaration": true,
5
+ "declarationMap": true,
6
+ "inlineSources": true,
7
+ "esModuleInterop": true,
8
+ "forceConsistentCasingInFileNames": true,
9
+ "moduleResolution": "nodenext",
10
+ "resolveJsonModule": true,
11
+ "skipLibCheck": true,
12
+ "sourceMap": true,
13
+ "strict": true,
14
+ "target": "es2022",
15
+ "module": "nodenext"
16
+ }
17
+ }