Skip to content

Commit 7659428

Browse files
committed
Use corepack, prepare OIDC publishing
1 parent de5096e commit 7659428

File tree

5 files changed

+35
-101
lines changed

5 files changed

+35
-101
lines changed

.github/workflows/dev-packages.yaml

Lines changed: 0 additions & 48 deletions
This file was deleted.

.github/workflows/release-packages.yaml

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,59 +4,58 @@ on:
44
push:
55
branches:
66
- main
7+
workflow_dispatch: # For dev publishing
78

89
concurrency: ${{ github.workflow }}-${{ github.ref }}
910

11+
permissions:
12+
id-token: write # Required for OIDC / trusted publishing
13+
contents: write # Required for changesets pushing commits
14+
pull-requests: write # Required for changesets creating PRs
15+
1016
jobs:
1117
release-packages:
1218
name: Release Packages
1319
runs-on: ubuntu-latest
1420
steps:
1521
- name: Checkout Repo
16-
uses: actions/checkout@v4
22+
uses: actions/checkout@v5
23+
- name: Enable Corepack
24+
run: corepack enable
1725

1826
- name: Setup Node.js
19-
uses: actions/setup-node@v4
27+
uses: actions/setup-node@v6
2028
with:
2129
node-version-file: '.nvmrc'
22-
23-
- uses: pnpm/action-setup@v4
24-
name: Install pnpm
25-
with:
26-
version: 9
27-
run_install: false
28-
29-
- name: Get pnpm store directory
30-
shell: bash
31-
run: |
32-
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
33-
34-
- uses: actions/cache@v3
35-
name: Setup pnpm cache
36-
with:
37-
path: ${{ env.STORE_PATH }}
38-
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
39-
restore-keys: |
40-
${{ runner.os }}-pnpm-store-
41-
42-
- name: Add NPM auth
43-
run: |
44-
echo "//registry.npmjs.org/:_authToken=${{secrets.NPM_TOKEN}}" >> ~/.npmrc
30+
cache: pnpm
4531

4632
- name: Install dependencies
4733
run: pnpm install
34+
- name: Update npm
35+
run: |
36+
npm install -g npm@latest
37+
npm --version
4838
4939
- name: Create Release Pull Request or Publish to npm
5040
id: changesets
5141
uses: changesets/action@v1
42+
if: ${{ github.event_name == 'push' }}
5243
with:
5344
# This expects you to have a script called release which does a build for your packages and calls changeset publish
5445
publish: pnpm release
5546
version: pnpm changeset version
5647
env:
5748
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
5949

6050
- name: Debug Outputs
51+
if: ${{ github.event_name == 'push' }}
6152
run: |
62-
echo "Published Packages: ${{ steps.changesets.outputs.publishedPackages }}"
53+
echo "Published Packages: ${{ steps.changesets.outputs.publishedPackages }}"
54+
55+
- name: Dev publish
56+
if: ${{ github.event_name == 'workflow_dispatch' }}
57+
run: |
58+
pnpm changeset version --no-git-tag --snapshot dev
59+
pnpm changeset publish --tag dev
60+
env:
61+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test.yml

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ jobs:
1515
mysql-version: [ 8.0, 8.4 ]
1616

1717
steps:
18-
- uses: actions/checkout@v4
19-
with:
20-
persist-credentials: false
18+
- uses: actions/checkout@v5
19+
- name: Enable Corepack
20+
run: corepack enable
2121

2222
- name: Start MySQL
2323
run: |
@@ -29,31 +29,13 @@ jobs:
2929
--log-bin=/var/lib/mysql/mysql-bin.log
3030
3131
- name: Setup NodeJS
32-
uses: actions/setup-node@v4
32+
uses: actions/setup-node@v6
3333
with:
3434
node-version-file: '.nvmrc'
35-
36-
- uses: pnpm/action-setup@v4
37-
name: Install pnpm
38-
with:
39-
version: 9
40-
run_install: false
41-
42-
- name: Get pnpm store directory
43-
shell: bash
44-
run: |
45-
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
46-
47-
- uses: actions/cache@v3
48-
name: Setup pnpm cache
49-
with:
50-
path: ${{ env.STORE_PATH }}
51-
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
52-
restore-keys: |
53-
${{ runner.os }}-pnpm-store-
35+
cache: pnpm
5436

5537
- name: Install dependencies
5638
run: pnpm install
5739

5840
- name: Test
59-
run: pnpm test
41+
run: pnpm test

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v22.14.0
1+
v22.21.0

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,6 @@
4747
"big-integer": "1.6.52",
4848
"iconv-lite": "0.6.3",
4949
"@vlasky/mysql": "^2.18.6"
50-
}
50+
},
51+
"packageManager": "pnpm@10.19.0+sha512.c9fc7236e92adf5c8af42fd5bf1612df99c2ceb62f27047032f4720b33f8eacdde311865e91c411f2774f618d82f320808ecb51718bfa82c060c4ba7c76a32b8"
5152
}

0 commit comments

Comments
 (0)