Skip to content

Commit 0fea136

Browse files
committed
Merge branch 'main' into refactor/utils/command-helper
2 parents 476adfa + 33714e2 commit 0fea136

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+344
-222
lines changed

.env.example

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
11
# for uploading to portal
2-
CP_SERVER=
32
CP_API_KEY=
4-
CP_ORGANIZATION=
5-
CP_PROJECT=

.github/workflows/ci.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- name: Set up Node.js
2323
uses: actions/setup-node@v4
2424
with:
25-
node-version-file: .nvmrc
25+
node-version-file: .node-version
2626
cache: npm
2727
- name: Set base and head for Nx affected commands
2828
uses: nrwl/nx-set-shas@v4
@@ -42,7 +42,7 @@ jobs:
4242
- name: Set up Node.js
4343
uses: actions/setup-node@v4
4444
with:
45-
node-version-file: .nvmrc
45+
node-version-file: .node-version
4646
cache: npm
4747
- name: Set base and head for Nx affected commands
4848
uses: nrwl/nx-set-shas@v4
@@ -66,7 +66,7 @@ jobs:
6666
- name: Set up Node.js
6767
uses: actions/setup-node@v4
6868
with:
69-
node-version-file: .nvmrc
69+
node-version-file: .node-version
7070
cache: npm
7171
- name: Set base and head for Nx affected commands
7272
uses: nrwl/nx-set-shas@v4
@@ -90,7 +90,7 @@ jobs:
9090
- name: Set up Node.js
9191
uses: actions/setup-node@v4
9292
with:
93-
node-version-file: .nvmrc
93+
node-version-file: .node-version
9494
cache: npm
9595
- name: Set base and head for Nx affected commands
9696
uses: nrwl/nx-set-shas@v4
@@ -114,7 +114,7 @@ jobs:
114114
- name: Set up Node.js
115115
uses: actions/setup-node@v4
116116
with:
117-
node-version-file: .nvmrc
117+
node-version-file: .node-version
118118
cache: npm
119119
- name: Set base and head for Nx affected commands
120120
uses: nrwl/nx-set-shas@v4
@@ -134,7 +134,7 @@ jobs:
134134
- name: Set up Node.js
135135
uses: actions/setup-node@v4
136136
with:
137-
node-version-file: .nvmrc
137+
node-version-file: .node-version
138138
cache: npm
139139
- name: Set base and head for Nx affected commands
140140
uses: nrwl/nx-set-shas@v4

.github/workflows/code-coverage.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Set up Node.js
1919
uses: actions/setup-node@v4
2020
with:
21-
node-version-file: .nvmrc
21+
node-version-file: .node-version
2222
cache: npm
2323
- name: Install dependencies
2424
run: npm ci
@@ -43,7 +43,7 @@ jobs:
4343
- name: Set up Node.js
4444
uses: actions/setup-node@v4
4545
with:
46-
node-version-file: .nvmrc
46+
node-version-file: .node-version
4747
cache: npm
4848
- name: Install dependencies
4949
run: npm ci

.github/workflows/code-pushup-fork.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
- name: Set up Node.js
3131
uses: actions/setup-node@v4
3232
with:
33-
node-version-file: .nvmrc
33+
node-version-file: .node-version
3434
cache: npm
3535
- name: Set base and head for Nx affected commands
3636
uses: nrwl/nx-set-shas@v4

.github/workflows/code-pushup.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@ jobs:
2020
# ignore PRs from forks, handled by code-pushup-fork.yml
2121
if: ${{ !github.event.pull_request.head.repo.fork }}
2222
env:
23-
CP_SERVER: ${{ secrets.CP_SERVER }}
2423
CP_API_KEY: ${{ secrets.CP_API_KEY }}
25-
CP_ORGANIZATION: code-pushup
26-
CP_PROJECT: cli
2724
steps:
2825
- name: Checkout repository
2926
uses: actions/checkout@v4
@@ -32,7 +29,7 @@ jobs:
3229
- name: Set up Node.js
3330
uses: actions/setup-node@v4
3431
with:
35-
node-version-file: .nvmrc
32+
node-version-file: .node-version
3633
cache: npm
3734
- name: Set base and head for Nx affected commands
3835
uses: nrwl/nx-set-shas@v4
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Dependency Review
2+
3+
on: pull_request
4+
5+
permissions:
6+
contents: read
7+
pull-requests: write
8+
9+
jobs:
10+
dependency-review:
11+
runs-on: ubuntu-latest
12+
name: Scan new dependencies
13+
steps:
14+
- name: Clone repository
15+
uses: actions/checkout@v4
16+
- name: Check for vulnerabilities in new dependencies
17+
uses: actions/dependency-review-action@v4
18+
with:
19+
comment-summary-in-pr: on-failure

.github/workflows/publish.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Publish
2+
3+
on:
4+
push:
5+
tags:
6+
- v*.*.*
7+
8+
concurrency:
9+
group: publish
10+
cancel-in-progress: false
11+
12+
# configured as trusted publisher (OIDC)
13+
# https://docs.npmjs.com/trusted-publishers
14+
permissions:
15+
contents: read
16+
id-token: write
17+
18+
env:
19+
NX_NON_NATIVE_HASHER: true
20+
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
21+
22+
jobs:
23+
publish:
24+
name: Publish packages
25+
runs-on: ubuntu-latest
26+
environment: release
27+
steps:
28+
- name: Clone the repository
29+
uses: actions/checkout@v4
30+
with:
31+
fetch-depth: 0
32+
- name: Configure Git user
33+
# https://github.com/actions/checkout/blob/main/README.md#push-a-commit-using-the-built-in-token
34+
run: |
35+
git config user.name github-actions[bot]
36+
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
37+
- name: Set up Node.js
38+
uses: actions/setup-node@v4
39+
with:
40+
node-version-file: .node-version
41+
cache: npm
42+
- name: Install dependencies
43+
run: npm ci
44+
- name: Publish packages to npm
45+
run: npx nx release publish

.github/workflows/release.yml

Lines changed: 28 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,97 +1,51 @@
1-
name: Release Packages
1+
name: Release
22

33
on:
4-
pull_request:
5-
branches:
6-
- main
74
push:
85
branches:
96
- main
10-
workflow_dispatch:
11-
inputs:
12-
dryRun:
13-
type: choice
14-
description: 'Dry run'
15-
required: true
16-
default: 'false'
17-
options:
18-
- 'true'
19-
- 'false'
207

21-
env:
22-
NX_NON_NATIVE_HASHER: true
23-
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
8+
concurrency:
9+
group: release
10+
cancel-in-progress: false
2411

2512
jobs:
26-
dry-run-release:
27-
if: |
28-
github.repository == 'code-pushup/cli' && (
29-
github.event_name == 'pull_request' ||
30-
(github.event_name == 'workflow_dispatch' && github.event.inputs.dryRun == 'true')
31-
)
32-
name: Dry run release
33-
runs-on: ubuntu-latest
34-
steps:
35-
- name: Checkout the repository
36-
uses: actions/checkout@v4
37-
with:
38-
fetch-depth: 0
39-
- name: Set up Node.js
40-
uses: actions/setup-node@v4
41-
with:
42-
node-version-file: .nvmrc
43-
cache: npm
44-
- name: Install dependencies
45-
run: npm ci
46-
- name: Version, release and publish packages
47-
run: npx nx release --yes --dry-run
4813
release:
49-
if: |
50-
github.repository == 'code-pushup/cli' && (
51-
(github.event_name == 'workflow_dispatch' && github.event.inputs.dryRun == 'false') ||
52-
(github.event_name == 'push')
53-
)
54-
name: Release packages
14+
name: Version and release
5515
runs-on: ubuntu-latest
56-
permissions:
57-
contents: write
16+
environment: release
17+
env:
18+
NX_NON_NATIVE_HASHER: true
19+
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
5820
steps:
59-
- name: Generate a token
60-
id: generate_token
61-
uses: actions/create-github-app-token@v1
21+
- name: Authenticate as "Code PushUp Bot" GitHub App
22+
uses: actions/create-github-app-token@v2
23+
id: app-token
6224
with:
63-
app-id: ${{ secrets.GH_APP_ID }}
25+
app-id: ${{ vars.GH_APP_ID }}
6426
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
65-
- name: Checkout the repository
27+
- name: Fetch GitHub App's user ID
28+
id: get-user-id
29+
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
30+
env:
31+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
32+
- name: Configure Git user
33+
run: |
34+
git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]'
35+
git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com'
36+
- name: Clone the repository
6637
uses: actions/checkout@v4
6738
with:
6839
fetch-depth: 0
69-
token: ${{ steps.generate_token.outputs.token }}
70-
- name: Set up Git
71-
run: |
72-
git config user.name github-actions
73-
git config user.email github-actions@github.com
40+
token: ${{ steps.app-token.outputs.token }}
7441
- name: Set up Node.js
7542
uses: actions/setup-node@v4
7643
with:
77-
node-version-file: .nvmrc
44+
node-version-file: .node-version
7845
cache: npm
7946
- name: Install dependencies
8047
run: npm ci
81-
- name: Version, release and publish packages
82-
env:
83-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
84-
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
85-
run: |
86-
echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" >> .npmrc
87-
npx nx release --yes
88-
git push --follow-tags
89-
- name: Run Code PushUp on release commit
90-
uses: code-pushup/github-action@v0
91-
with:
92-
bin: npx nx code-pushup --
48+
- name: Version, release and generate changelog
49+
run: npx nx release --skip-publish
9350
env:
94-
CP_SERVER: ${{ secrets.CP_SERVER }}
95-
CP_API_KEY: ${{ secrets.CP_API_KEY }}
96-
CP_ORGANIZATION: code-pushup
97-
CP_PROJECT: cli
51+
GH_TOKEN: ${{ steps.app-token.outputs.token }}

.node-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
24.8.0

.nvmrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)