Skip to content

Commit 9de2876

Browse files
authored
chore(ci): release preview to pkg.pr.new (#32)
* chore(ci): move setup step to action * chore(ci): add release preview * chore(ci): move actions dir * chore: test * revert: test
1 parent 8ed2288 commit 9de2876

File tree

4 files changed

+74
-26
lines changed

4 files changed

+74
-26
lines changed

.github/actions/setup/action.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Setup
2+
3+
description: Setup tools and prepare environment
4+
5+
runs:
6+
using: composite
7+
steps:
8+
- name: Setup pnpm
9+
uses: pnpm/action-setup@v4
10+
11+
- name: Setup Nodejs
12+
uses: actions/setup-node@v4
13+
with:
14+
registry-url: https://registry.npmjs.org/
15+
node-version-file: .tool-versions
16+
17+
- name: Get pnpm store directory
18+
shell: bash
19+
run: |
20+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
21+
22+
- name: Setup pnpm cache
23+
uses: actions/cache@v4
24+
with:
25+
path: ${{ env.STORE_PATH }}
26+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
27+
restore-keys: |
28+
${{ runner.os }}-pnpm-store-
29+
30+
- name: Install dependencies
31+
shell: bash
32+
run: pnpm install --frozen-lockfile
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Release Preview
2+
3+
on:
4+
pull_request:
5+
workflow_dispatch:
6+
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
9+
cancel-in-progress: true
10+
11+
permissions:
12+
contents: write
13+
14+
jobs:
15+
publish-pkg-pr-new:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
23+
- name: Setup
24+
uses: ./.github/actions/setup
25+
26+
- name: Build packages
27+
run: pnpm run build
28+
29+
- name: Publish to pkg.pr.new
30+
run: pnpx pkg-pr-new publish --pnpm

.github/workflows/release.yml

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,13 @@ jobs:
1212
publish-npm:
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v4
15+
- name: Checkout
16+
uses: actions/checkout@v4
1617
with:
1718
fetch-depth: 0
1819

19-
- name: Setup pnpm
20-
uses: pnpm/action-setup@v2
21-
22-
- name: Setup Nodejs
23-
uses: actions/setup-node@v4
24-
with:
25-
cache: pnpm
26-
registry-url: https://registry.npmjs.org/
27-
node-version-file: .tool-versions
28-
29-
- name: Install Dependencies
30-
run: pnpm i
20+
- name: Setup
21+
uses: ./.github/actions/setup
3122

3223
- name: Build dist
3324
run: pnpm run build

.github/workflows/test.yml

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,21 @@ on:
99
branches:
1010
- main
1111

12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
14+
cancel-in-progress: true
15+
1216
jobs:
1317
test:
1418
runs-on: ubuntu-latest
1519
steps:
16-
- uses: actions/checkout@v4
20+
- name: Checkout
21+
uses: actions/checkout@v4
1722
with:
1823
fetch-depth: 0
1924

20-
- name: Setup pnpm
21-
uses: pnpm/action-setup@v2
22-
23-
- name: Setup Nodejs
24-
uses: actions/setup-node@v4
25-
with:
26-
cache: pnpm
27-
registry-url: https://registry.npmjs.org/
28-
node-version-file: .tool-versions
29-
30-
- name: Install Dependencies
31-
run: pnpm i
25+
- name: Setup
26+
uses: ./.github/actions/setup
3227

3328
- name: Run Test
3429
run: pnpm run test

0 commit comments

Comments
 (0)