From 7e1af132e5b2fa7b912bd757acc0a7a7314290fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lk=28=E5=88=98=E5=9D=A4=29?= Date: Fri, 28 Mar 2025 18:06:25 +0800 Subject: [PATCH 1/4] =?UTF-8?q?chore:=20=E6=B5=8B=E8=AF=95merge?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 485b617..dfb346e 100644 --- a/.gitignore +++ b/.gitignore @@ -10,7 +10,7 @@ dist *.tgz *.local.* -# package-lock.json +package-lock.json .DS_Store .cache node_modules/ From ac1967cb2901b58cc0f85a337c347eb5816d76aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lk=28=E5=88=98=E5=9D=A4=29?= Date: Fri, 28 Mar 2025 18:15:19 +0800 Subject: [PATCH 2/4] ci: github actions publish --- .github/workflows/check-status.yml | 41 +++++++++++++-------------- .github/workflows/deploy-gh-pages.yml | 41 +++++++++++++-------------- .github/workflows/npm-publish.yml | 40 +++++++++++--------------- 3 files changed, 55 insertions(+), 67 deletions(-) diff --git a/.github/workflows/check-status.yml b/.github/workflows/check-status.yml index 8d42e60..235ec7d 100644 --- a/.github/workflows/check-status.yml +++ b/.github/workflows/check-status.yml @@ -13,44 +13,41 @@ jobs: - name: checkout uses: actions/checkout@v3 - - name: cache package-lock.json - uses: actions/cache@v3 + - name: Install pnpm + uses: pnpm/action-setup@v2 with: - path: package-temp-dir - key: lock-${{ github.sha }} - - - name: create package-lock.json - run: npm i --package-lock-only + version: 8 - - name: hack for singe file - run: | - if [ ! -d "package-temp-dir" ]; then - mkdir package-temp-dir - fi - cp package-lock.json package-temp-dir + - name: cache pnpm store + uses: actions/cache@v3 + with: + path: ~/.pnpm-store + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- - name: cache node_modules id: node_modules_cache_id uses: actions/cache@v3 with: path: node_modules - key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }} + key: node_modules-${{ hashFiles('**/pnpm-lock.yaml') }} - name: install if: steps.node_modules_cache_id.outputs.cache-hit != 'true' - run: npm ci + run: pnpm install - # - name: eslint - # run: npm run eslint - - - name: coverage - run: npm run coverage + - name: test + run: pnpm run test - name: build - run: npm run build + run: pnpm run build + + - name: coverage + run: pnpm run coverage - name: build:docs - run: npm run build:docs + run: pnpm run build:docs - name: moveCoverage run: sh ./scripts/mv-coverage.sh diff --git a/.github/workflows/deploy-gh-pages.yml b/.github/workflows/deploy-gh-pages.yml index ae4b088..08f475e 100644 --- a/.github/workflows/deploy-gh-pages.yml +++ b/.github/workflows/deploy-gh-pages.yml @@ -8,6 +8,8 @@ on: jobs: build-and-deploy: runs-on: ubuntu-latest + permissions: + contents: write steps: - name: set node version uses: actions/setup-node@v3 @@ -17,48 +19,43 @@ jobs: - name: checkout uses: actions/checkout@v3 - - name: cache package-lock.json - uses: actions/cache@v3 + - name: Install pnpm + uses: pnpm/action-setup@v2 with: - path: package-temp-dir - key: lock-${{ github.sha }} - - - name: create package-lock.json - run: npm i --package-lock-only + version: 8 - - name: hack for singe file - run: | - if [ ! -d "package-temp-dir" ]; then - mkdir package-temp-dir - fi - cp package-lock.json package-temp-dir + - name: cache pnpm store + uses: actions/cache@v3 + with: + path: ~/.pnpm-store + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- - name: cache node_modules id: node_modules_cache_id uses: actions/cache@v3 with: path: node_modules - key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }} + key: node_modules-${{ hashFiles('**/pnpm-lock.yaml') }} - name: install if: steps.node_modules_cache_id.outputs.cache-hit != 'true' - run: npm ci + run: pnpm install # - name: eslint # run: npm run eslint - name: coverage - run: npm run coverage + run: pnpm run coverage - name: build:docs - run: npm run build:docs + run: pnpm run build:docs - name: moveCoverage run: sh ./scripts/mv-coverage.sh - - name: deploy - uses: JamesIves/github-pages-deploy-action@4.4.1 + - name: Deploy + uses: actions/deploy-pages@v3 with: - token: ${{ secrets.GIT_KEY }} - branch: gh-pages - folder: ./docs/.vuepress/dist + path: ./docs/.vuepress/dist diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 0dd5ed7..05b6025 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -16,47 +16,41 @@ jobs: - name: checkout uses: actions/checkout@v3 - - name: set up NPM authentication - run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_KEY }}" > ~/.npmrc + - name: Install pnpm + uses: pnpm/action-setup@v2 + with: + version: 8 - - name: cache package-lock.json + - name: cache pnpm store uses: actions/cache@v3 with: - path: package-temp-dir - key: lock-${{ github.sha }} - - - name: create package-lock.json - run: npm i --package-lock-only + path: ~/.pnpm-store + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- - - name: hack for singe file - run: | - if [ ! -d "package-temp-dir" ]; then - mkdir package-temp-dir - fi - cp package-lock.json package-temp-dir + - name: set up NPM authentication + run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_KEY }}" > ~/.npmrc - name: cache node_modules id: node_modules_cache_id uses: actions/cache@v3 with: path: node_modules - key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }} + key: node_modules-${{ hashFiles('**/pnpm-lock.yaml') }} - name: install if: steps.node_modules_cache_id.outputs.cache-hit != 'true' - run: npm ci - - # - name: eslint - # run: npm run eslint + run: pnpm install - - name: coverage - run: npm run coverage + - name: test + run: pnpm run test - name: build - run: npm run build + run: pnpm run build - name: publish - run: npm publish + run: pnpm publish --no-git-checks env: GITHUB_TOKEN: ${{ secrets.GIT_KEY }} NPM_AUTH_TOKEN: ${{ secrets.NPM_KEY }} From e410dfd81c7cfdb3bde3d1d3b4d68d8468c4391e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lk=28=E5=88=98=E5=9D=A4=29?= Date: Fri, 28 Mar 2025 18:28:07 +0800 Subject: [PATCH 3/4] ci: github actions publish key auth --- .github/workflows/deploy-gh-pages.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy-gh-pages.yml b/.github/workflows/deploy-gh-pages.yml index 08f475e..32f0a7e 100644 --- a/.github/workflows/deploy-gh-pages.yml +++ b/.github/workflows/deploy-gh-pages.yml @@ -1,6 +1,6 @@ name: Deploy gh-pages on: - pull_request: + push: branches: - master - dev @@ -10,6 +10,7 @@ jobs: runs-on: ubuntu-latest permissions: contents: write + id-token: write steps: - name: set node version uses: actions/setup-node@v3 From 13cf9bc786f6f2487b70b747ae71b24b1024f8fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lk=28=E5=88=98=E5=9D=A4=29?= Date: Fri, 28 Mar 2025 18:38:30 +0800 Subject: [PATCH 4/4] =?UTF-8?q?ci:=20check=20status=20=E5=8C=BA=E5=88=86pu?= =?UTF-8?q?sh=20pr?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/check-status.yml | 10 +++++++++- .github/workflows/deploy-gh-pages.yml | 7 +++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/workflows/check-status.yml b/.github/workflows/check-status.yml index 235ec7d..6ae09e9 100644 --- a/.github/workflows/check-status.yml +++ b/.github/workflows/check-status.yml @@ -1,5 +1,13 @@ name: Check Status -on: [push, pull_request] +on: + pull_request: + branches: + - master + - dev + push: + branches-ignore: + - master + - dev jobs: check-status: diff --git a/.github/workflows/deploy-gh-pages.yml b/.github/workflows/deploy-gh-pages.yml index 32f0a7e..3a62d49 100644 --- a/.github/workflows/deploy-gh-pages.yml +++ b/.github/workflows/deploy-gh-pages.yml @@ -56,7 +56,10 @@ jobs: - name: moveCoverage run: sh ./scripts/mv-coverage.sh - - name: Deploy - uses: actions/deploy-pages@v3 + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 with: path: ./docs/.vuepress/dist + + - name: Deploy + uses: actions/deploy-pages@v3