Skip to content

Commit 9172251

Browse files
committed
ci: automate releases
1 parent 3a1e2f6 commit 9172251

File tree

1 file changed

+13
-71
lines changed

1 file changed

+13
-71
lines changed

.github/workflows/release.yml

Lines changed: 13 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,32 @@
1-
name: Release Packages
1+
name: Release
22

33
on:
4-
pull_request:
5-
branches:
6-
- main
74
push:
8-
branches:
9-
- 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'
5+
# TODO
6+
# branches:
7+
# - main
208

219
env:
2210
NX_NON_NATIVE_HASHER: true
2311
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
2412

2513
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: .node-version
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
4814
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
15+
name: Publish packages
5516
runs-on: ubuntu-latest
5617
permissions:
5718
contents: write
19+
id-token: write
5820
steps:
59-
- name: Generate a token
60-
id: generate_token
61-
uses: actions/create-github-app-token@v1
62-
with:
63-
app-id: ${{ secrets.GH_APP_ID }}
64-
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
65-
- name: Checkout the repository
21+
- name: Clone the repository
6622
uses: actions/checkout@v4
6723
with:
6824
fetch-depth: 0
69-
token: ${{ steps.generate_token.outputs.token }}
70-
- name: Set up Git
25+
- name: Configure Git user
26+
# https://github.com/actions/checkout/blob/main/README.md#push-a-commit-using-the-built-in-token
7127
run: |
72-
git config user.name github-actions
73-
git config user.email github-actions@github.com
28+
git config user.name github-actions[bot]
29+
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
7430
- name: Set up Node.js
7531
uses: actions/setup-node@v4
7632
with:
@@ -79,19 +35,5 @@ jobs:
7935
- name: Install dependencies
8036
run: npm ci
8137
- 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 --
93-
env:
94-
CP_SERVER: ${{ secrets.CP_SERVER }}
95-
CP_API_KEY: ${{ secrets.CP_API_KEY }}
96-
CP_ORGANIZATION: code-pushup
97-
CP_PROJECT: cli
38+
# TODO
39+
run: npx nx release --yes --dry-run

0 commit comments

Comments
 (0)