Skip to content

Commit 03307b8

Browse files
committed
ci: add typecheck && improve workflows
1 parent f7bfba2 commit 03307b8

File tree

3 files changed

+70
-47
lines changed

3 files changed

+70
-47
lines changed

.github/workflows/build.yml

+9-20
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
name: build
12
on:
23
workflow_call:
34
inputs:
@@ -18,46 +19,34 @@ on:
1819
type: string
1920

2021
env:
21-
CI: true
22+
default_node_version: "lts/*"
23+
default_pnpm_version: 8
2224

2325
jobs:
2426
build:
27+
name: build
2528
runs-on: ${{ inputs.runs_on }}
2629
steps:
2730
- uses: actions/checkout@v4
2831
with:
2932
submodules: "recursive"
3033

31-
- uses: actions/setup-node@v4
32-
with:
33-
node-version: ${{ inputs.node_version }}
34-
3534
- uses: pnpm/action-setup@v2
3635
name: Install pnpm
3736
with:
38-
version: 8
39-
40-
- name: Get pnpm store directory
41-
shell: bash
42-
run: |
43-
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
37+
version: ${{env.default_pnpm_version}}
4438

45-
- uses: actions/cache@v4
46-
name: Setup pnpm cache
47-
if: ${{ inputs.cache }}
39+
- uses: actions/setup-node@v4
4840
with:
49-
path: |
50-
${{ env.STORE_PATH }}
51-
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
52-
restore-keys: |
53-
${{ runner.os }}-pnpm-store-
41+
node-version: ${{ inputs.node_version }}
42+
cache: pnpm
5443

5544
- name: Install Dependencies
5645
run: pnpm i
5746

5847
- name: Build
5948
run: |
60-
pnpm esb
49+
pnpm run build
6150
6251
- name: get hexo-starter hash
6352
shell: bash

.github/workflows/ci.yml

+41-26
Original file line numberDiff line numberDiff line change
@@ -18,50 +18,64 @@ on:
1818
- ".github/workflows/ci.yml"
1919

2020
env:
21-
CI: true
21+
default_node_version: "lts/*"
22+
default_pnpm_version: 8
2223

2324
jobs:
2425
lint:
26+
name: Lint
2527
runs-on: ubuntu-latest
2628
steps:
2729
- uses: actions/checkout@v4
2830
with:
2931
submodules: "recursive"
3032

33+
- uses: pnpm/action-setup@v2
34+
name: Install pnpm
35+
with:
36+
version: ${{env.default_pnpm_version}}
37+
3138
- uses: actions/setup-node@v4
3239
with:
33-
node-version: "lts/*"
40+
node-version: ${{env.default_node_version}}
41+
cache: pnpm
42+
43+
- name: Install Dependencies
44+
run: pnpm i
45+
46+
- name: Lint
47+
run: |
48+
pnpm run lint
49+
50+
type:
51+
name: Type Check
52+
runs-on: ubuntu-latest
53+
steps:
54+
- uses: actions/checkout@v4
3455

3556
- uses: pnpm/action-setup@v2
3657
name: Install pnpm
3758
with:
38-
version: 8
59+
version: ${{env.default_pnpm_version}}
3960

40-
- name: Get pnpm store directory
41-
shell: bash
42-
run: |
43-
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
44-
45-
- uses: actions/cache@v4
46-
name: Setup pnpm cache
61+
- uses: actions/setup-node@v4
4762
with:
48-
path: |
49-
${{ env.STORE_PATH }}
50-
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
51-
restore-keys: |
52-
${{ runner.os }}-pnpm-store-
63+
node-version: ${{env.default_node_version}}
64+
cache: pnpm
5365

5466
- name: Install Dependencies
5567
run: pnpm i
5668

5769
- name: Lint
5870
run: |
59-
pnpm run lint
71+
pnpm run lint:type
6072
6173
build:
74+
name: Build
6275
uses: ./.github/workflows/build.yml
6376

6477
test-ve:
78+
name: test-ve
6579
needs: build
6680
runs-on: ${{ matrix.os }}
6781
services:
@@ -84,15 +98,15 @@ jobs:
8498
with:
8599
name: artifact
86100

87-
- uses: actions/setup-node@v4
88-
with:
89-
node-version: "lts/*"
90-
91101
- uses: pnpm/action-setup@v2
92102
name: Install pnpm
93103
if: ${{ matrix.pm == 'pnpm' }}
94104
with:
95-
version: 8
105+
version: ${{env.default_pnpm_version}}
106+
107+
- uses: actions/setup-node@v4
108+
with:
109+
node-version: ${{env.default_node_version}}
96110

97111
- name: login to 'verdaccio'
98112
run: npx npm-cli-login -u test -p 1234 -e test@domain.test -r http://localhost:4873
@@ -117,6 +131,7 @@ jobs:
117131
${{ matrix.pm }} create hexo
118132
119133
test-ln:
134+
name: test-ln
120135
needs: build
121136
runs-on: ${{ matrix.os }}
122137
strategy:
@@ -134,15 +149,15 @@ jobs:
134149
with:
135150
name: artifact
136151

137-
- uses: actions/setup-node@v4
138-
with:
139-
node-version: "lts/*"
140-
141152
- uses: pnpm/action-setup@v2
142153
name: Install pnpm
143154
if: ${{ matrix.pm == 'pnpm' }}
144155
with:
145-
version: 8
156+
version: ${{env.default_pnpm_version}}
157+
158+
- uses: actions/setup-node@v4
159+
with:
160+
node-version: ${{env.default_node_version}}
146161

147162
- name: config for test
148163
run: |

.github/workflows/publish.yml

+20-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
workflow_dispatch:
88
inputs:
99
version:
10-
description: "the package version you want to bump"
10+
description: ""
1111
required: true
1212
default: "keep current"
1313
type: choice
@@ -18,8 +18,12 @@ on:
1818
tags:
1919
- "v*.*.*"
2020

21+
env:
22+
default_node_version: "lts/*"
23+
2124
jobs:
2225
build:
26+
name: Build
2327
uses: ./.github/workflows/build.yml
2428

2529
publish-npm:
@@ -79,3 +83,18 @@ jobs:
7983
- run: npm publish --access public --registry=https://npm.pkg.github.com
8084
env:
8185
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
86+
87+
release:
88+
name: Release
89+
needs: publish-npm
90+
runs-on: ubuntu-latest
91+
permissions:
92+
contents: write
93+
discussions: write
94+
steps:
95+
- name: Release
96+
uses: softprops/action-gh-release@v1
97+
if: startsWith(github.ref, 'refs/tags/')
98+
with:
99+
generate_release_notes: true
100+
discussion_category_name: "Announcements"

0 commit comments

Comments
 (0)