Skip to content

Commit 6ac7d28

Browse files
committed
ci: some improve on workflows
1 parent be0157c commit 6ac7d28

File tree

6 files changed

+52
-39
lines changed

6 files changed

+52
-39
lines changed

.github/actions/verdaccio-actions/action.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ inputs:
3838
description: "the authtoken of your verdaccio registry"
3939
required: false
4040
token-config-location:
41-
description: "Define the location of token config. passed to `npm set ... --location <token-config-location>`"
41+
description: "Define the location of token config. passed to `npm config set ... --location <token-config-location>`"
4242
required: false
4343
default: "project"
4444
registry-config:
4545
description: "whether to setup registry setting in npm configuration"
4646
required: false
4747
default: "false"
4848
registry-config-location:
49-
description: "Define the location of register config. passed to `npm set ... --location <registry-config-location>`"
49+
description: "Define the location of register config. passed to `npm config set ... --location <registry-config-location>`"
5050
required: false
5151
default: "project"
5252

@@ -58,13 +58,7 @@ outputs:
5858
runs:
5959
using: "composite"
6060
steps:
61-
- name: Install pnpm
62-
uses: pnpm/action-setup@v3
63-
if: ${{ inputs.package-manager == 'pnpm' }}
64-
with:
65-
version: "8"
66-
67-
- name: Install verdaccio global
61+
- name: Install verdaccio global via ${{ inputs.package-manager }}
6862
shell: bash
6963
if: ${{ inputs.install-global == 'true' }}
7064
run: |

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ updates:
4444
- package-ecosystem: "gitsubmodule"
4545
directory: "/"
4646
schedule:
47-
interval: "weekly"
47+
interval: "daily"
4848
labels:
4949
- "dependencies"
5050
- "submodules"

.github/workflows/build.yml

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ on:
33
workflow_call:
44
inputs:
55
cache:
6-
description: "(boolean) use actions/cache"
6+
description: "(boolean) enable actions/cache for pnpm"
77
required: false
88
default: true
99
type: boolean
@@ -17,10 +17,16 @@ on:
1717
required: false
1818
default: "ubuntu-latest"
1919
type: string
20+
pnpm_version:
21+
description: "(string) "
22+
required: false
23+
default: "latest"
24+
type: string
2025

2126
env:
2227
default_node_version: "lts/*"
23-
default_pnpm_version: 8
28+
default_pnpm_version: "latest"
29+
artifact_name: build_${{ github.sha }}
2430

2531
jobs:
2632
build:
@@ -34,12 +40,20 @@ jobs:
3440
- uses: pnpm/action-setup@v4
3541
name: Install pnpm
3642
with:
37-
version: ${{env.default_pnpm_version}}
43+
version: ${{ inputs.pnpm_version }}
44+
45+
- uses: actions/setup-node@v4
46+
name: Setup Node without cache
47+
if: ${{ !inputs.cache }}
48+
with:
49+
node-version: ${{ inputs.node_version }}
3850

3951
- uses: actions/setup-node@v4
52+
name: Setup Node with cache
53+
if: ${{ inputs.cache }}
4054
with:
4155
node-version: ${{ inputs.node_version }}
42-
cache: pnpm
56+
cache: "pnpm"
4357

4458
- name: Install Dependencies
4559
run: pnpm i
@@ -48,16 +62,16 @@ jobs:
4862
run: |
4963
pnpm run build
5064
51-
- name: get hexo-starter hash
65+
- name: get hash of `hexo-starter`
5266
shell: bash
5367
run: |
54-
echo -n $(cat .git/modules/hexo-starter/refs/heads/master) > hash
68+
pnpm run hash
5569
5670
- uses: actions/upload-artifact@v4
5771
with:
5872
retention-days: 1
5973
compression-level: 1
60-
name: artifact
74+
name: ${{ env.artifact_name }}
6175
path: |
6276
bin
6377
hash

.github/workflows/ci.yml

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,29 @@ on:
66
- "main"
77
paths:
88
- "src/**.tsx?"
9+
- "hexo-starter"
10+
- ".gitmodules"
911
- "package.json"
1012
- "tsconfig.json"
1113
- ".github/workflows/ci.yml"
1214
pull_request:
1315
paths:
1416
- "src/**.tsx?"
1517
- "scripts/**"
18+
- "hexo-starter"
19+
- ".gitmodules"
1620
- "package.json"
1721
- "tsconfig.json"
1822
- ".github/workflows/ci.yml"
1923

2024
env:
2125
default_node_version: "lts/*"
22-
default_pnpm_version: 8
26+
default_pnpm_version: "latest"
27+
artifact_name: build_${{ github.sha }}
2328

2429
jobs:
2530
lint:
26-
name: Lint
31+
name: ESLint
2732
runs-on: ubuntu-latest
2833
steps:
2934
- uses: actions/checkout@v4
@@ -43,11 +48,11 @@ jobs:
4348
- name: Install Dependencies
4449
run: pnpm i
4550

46-
- name: Lint
51+
- name: ESLint
4752
run: |
4853
pnpm run lint
4954
50-
type:
55+
type-check:
5156
name: Type Check
5257
runs-on: ubuntu-latest
5358
steps:
@@ -66,9 +71,9 @@ jobs:
6671
- name: Install Dependencies
6772
run: pnpm i
6873

69-
- name: Lint
74+
- name: Type Check
7075
run: |
71-
pnpm run lint:type
76+
pnpm run type-check
7277
7378
build:
7479
name: Build
@@ -91,7 +96,7 @@ jobs:
9196

9297
- uses: actions/download-artifact@v4
9398
with:
94-
name: artifact
99+
name: ${{ env.artifact_name }}
95100

96101
- uses: pnpm/action-setup@v4
97102
name: Install pnpm
@@ -103,23 +108,23 @@ jobs:
103108
with:
104109
node-version: ${{env.default_node_version}}
105110

106-
- name: setup 'verdaccio'
111+
- name: setup local registry via 'verdaccio'
107112
id: verdaccio
108113
uses: ./.github/actions/verdaccio-actions
109114
with:
110115
verdaccio-config: .verdaccio/.verdaccio.yaml
111116
token-config: true
112117
token-content: gHz2lB9wOy+kDV4Cyy+v0w==
113118

114-
- name: version for test
119+
- name: bump a version for testing
115120
run: |
116121
npm version major --commit-hooks false --git-tag-version false
117122
118-
- name: publish to 'verdaccio'
123+
- name: publish to local registry
119124
run: |
120125
npm publish --registry http://${{ steps.verdaccio.outputs.listen }}
121126
122-
- name: config for test
127+
- name: setup config for testing
123128
run: |
124129
mkdir ../.temp
125130
${{ matrix.pm }} config set registry http://${{ steps.verdaccio.outputs.listen }}

.github/workflows/publish.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ on:
2020

2121
env:
2222
default_node_version: "lts/*"
23+
artifact_name: build_${{ github.sha }}
2324

2425
jobs:
2526
build:
@@ -38,11 +39,11 @@ jobs:
3839

3940
- uses: actions/download-artifact@v4
4041
with:
41-
name: artifact
42+
name: ${{ env.artifact_name }}
4243

4344
- uses: actions/setup-node@v4
4445
with:
45-
# node-version: "lts/*"
46+
# node-version: ${{ env.default_node_version }}
4647
registry-url: https://registry.npmjs.org/
4748

4849
- run: npm publish --provenance --access public --registry=https://registry.npmjs.org/
@@ -65,7 +66,7 @@ jobs:
6566

6667
- uses: actions/setup-node@v4
6768
with:
68-
# node-version: "lts/*"
69+
# node-version: ${{ env.default_node_version }}
6970
registry-url: "https://npm.pkg.github.com/"
7071
# Defaults to the user or organization that owns the workflow file
7172
scope: ${{env.SCOPE}}
@@ -74,11 +75,11 @@ jobs:
7475

7576
- uses: actions/download-artifact@v4
7677
with:
77-
name: artifact
78+
name: ${{ env.artifact_name }}
7879

7980
- name: rename package name
8081
run: |
81-
node scripts/renamePackage.mjs
82+
node ./scripts/renamePackage.mjs
8283
8384
- run: npm publish --access public --registry=https://npm.pkg.github.com
8485
env:

package.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,17 @@
3333
"scripts": {
3434
"build": "pnpm run esb",
3535
"esb": "rm -rf bin && node ./scripts/esb.mjs ",
36-
"hash": "bash ./scripts/gethash.sh",
36+
"hash": "bash ./scripts/getHash.sh",
3737
"lint": "eslint .",
3838
"lint:fix": "eslint . --fix",
39-
"lint:type": "tsc --noEmit",
4039
"sort": "pnpm dlx sort-package-json",
4140
"test": "jest",
4241
"test:cov": "jest --coverage --coverageReporters html --coverageReporters text",
4342
"test:lcov": "jest --coverage --coverageReporters lcovonly --coverageReporters text-summary",
4443
"tsb": "tsc -b -v",
4544
"tsbf": "tsc -b -v -f",
46-
"tsbw": "tsc -b -v -w"
45+
"tsbw": "tsc -b -v -w",
46+
"type-check": "tsc --noEmit"
4747
},
4848
"dependencies": {
4949
"commander": "^12.0.0",
@@ -67,6 +67,5 @@
6767
},
6868
"engines": {
6969
"node": ">=20"
70-
},
71-
"#packageManager": "[email protected]+sha256.245fe901f8e7fa8782d7f17d32b6a83995e2ae03984cb5b62b8949bfdc27c7b5"
72-
}
70+
}
71+
}

0 commit comments

Comments
 (0)