Skip to content

Commit 5f42501

Browse files
authored
ci: support provenance (#135)
1 parent 9203eb5 commit 5f42501

File tree

4 files changed

+32
-38
lines changed

4 files changed

+32
-38
lines changed

.github/actions/initialize/action.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: "initialize"
2+
3+
runs:
4+
using: "composite"
5+
steps:
6+
- name: Setup Git Config
7+
run: |
8+
git config --global core.autocrlf false
9+
git config --global core.eol lf
10+
git config --global user.email "[email protected]"
11+
git config --global user.name "gh-actions"
12+
shell: bash

.github/workflows/build.yml

+9-9
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,29 @@ jobs:
77
build:
88
runs-on: ${{ matrix.os }}
99

10+
# @see https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#concurrency
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ matrix.os }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
1015
strategy:
1116
matrix:
12-
node-version: [20.x]
17+
node-version: [22.x]
1318
os: [windows-latest, ubuntu-latest]
1419

1520
steps:
16-
- name: Setup Git Config
17-
run: |
18-
git config --global core.autocrlf false
19-
git config --global core.eol lf
20-
git config --global user.email "[email protected]"
21-
git config --global user.name "gh-actions"
2221
- uses: actions/checkout@v3
22+
- uses: ./.github/actions/initialize
2323
- uses: pnpm/action-setup@v4
2424
with:
2525
version: 9.10.0
2626
- uses: actions/setup-node@v4
2727
with:
28-
node-version: "20.x"
28+
node-version: "22.x"
2929
cache: "pnpm"
3030
- run: pnpm i --frozen-lockfile
3131
- name: Use Node.js ${{ matrix.node-version }}
32-
uses: actions/setup-node@v1
32+
uses: actions/setup-node@v4
3333
with:
3434
node-version: ${{ matrix.node-version }}
3535
- name: Test & Build

.github/workflows/release.yml

+9-22
Original file line numberDiff line numberDiff line change
@@ -8,61 +8,50 @@ jobs:
88
build:
99
runs-on: ubuntu-latest
1010
steps:
11-
- name: Setup Git Config
12-
run: |
13-
git config --global core.autocrlf false
14-
git config --global core.eol lf
15-
git config --global user.email "[email protected]"
16-
git config --global user.name "gh-actions"
1711
- uses: actions/checkout@v3
1812
with:
1913
ref: main
14+
- uses: ./.github/actions/initialize
2015
- uses: pnpm/action-setup@v4
2116
with:
2217
version: 9.10.0
2318
- uses: actions/setup-node@v4
2419
with:
25-
node-version: "20.x"
20+
node-version: "22.x"
2621
registry-url: https://npm.pkg.github.com
2722
scope: "@Himenon"
2823
cache: "pnpm"
2924
- run: pnpm i --frozen-lockfile
3025
- run: |
3126
pnpm build
32-
env:
33-
CI: true
3427
3528
release-github-registry:
3629
runs-on: ubuntu-latest
3730
steps:
38-
- name: Setup Git Config
39-
run: |
40-
git config --global core.autocrlf false
41-
git config --global core.eol lf
42-
git config --global user.email "[email protected]"
43-
git config --global user.name "gh-actions"
4431
- uses: actions/checkout@v3
4532
with:
4633
ref: main
34+
- uses: ./.github/actions/initialize
4735
- uses: pnpm/action-setup@v4
4836
with:
4937
version: 9.10.0
5038
- uses: actions/setup-node@v4
5139
with:
52-
node-version: "20.x"
40+
node-version: "22.x"
5341
registry-url: https://npm.pkg.github.com
5442
scope: "@Himenon"
5543
cache: "pnpm"
5644
- run: pnpm install
5745
- run: |
5846
pnpm build
59-
pnpm release:github:registry
47+
pnpm run release:github:registry
6048
env:
6149
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62-
CI: true
6350
6451
release-npm-registry:
6552
runs-on: ubuntu-latest
53+
permissions:
54+
id-token: write
6655
steps:
6756
- uses: actions/checkout@v2
6857
with:
@@ -72,13 +61,11 @@ jobs:
7261
version: 9.10.0
7362
- uses: actions/setup-node@v4
7463
with:
75-
node-version: "20.x"
64+
node-version: "22.x"
7665
registry-url: "https://registry.npmjs.org"
7766
cache: "pnpm"
7867
- run: pnpm install
7968
- run: pnpm build
80-
env:
81-
CI: true
82-
- run: pnpm release:npm:registry
69+
- run: NPM_CONFIG_PROVENANCE=true pnpm run release:npm:registry
8370
env:
8471
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/versionUp.yml

+2-7
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,16 @@ jobs:
99
if: github.event_name != 'pull_request'
1010
runs-on: ubuntu-latest
1111
steps:
12-
- name: Setup Git Config
13-
run: |
14-
git config --global core.autocrlf false
15-
git config --global core.eol lf
16-
git config --global user.email "[email protected]"
17-
git config --global user.name "gh-actions"
1812
- uses: actions/checkout@v3
1913
with:
2014
ref: main
15+
- uses: ./.github/actions/initialize
2116
- uses: pnpm/action-setup@v4
2217
with:
2318
version: 9.10.0
2419
- uses: actions/setup-node@v4
2520
with:
26-
node-version: "20.x"
21+
node-version: "22.x"
2722
cache: "pnpm"
2823
- run: pnpm i --frozen-lockfile
2924
- name: Auto version update

0 commit comments

Comments
 (0)