From a684faee7cdfdbfe4812bf2b0df7f6933a7231be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=23=E4=BA=91=E6=B7=A1=E7=84=B6?= Date: Fri, 17 Mar 2023 11:34:11 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=20actions=2012?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/common-workflows/node-env.yml | 19 ------------------- .github/workflows/_node-env.yml | 19 +++++++++++++++++++ .github/workflows/code-review.yml | 4 ++-- .github/workflows/release-please.yml | 6 +++--- 4 files changed, 24 insertions(+), 24 deletions(-) delete mode 100644 .github/common-workflows/node-env.yml create mode 100644 .github/workflows/_node-env.yml diff --git a/.github/common-workflows/node-env.yml b/.github/common-workflows/node-env.yml deleted file mode 100644 index e843cb1..0000000 --- a/.github/common-workflows/node-env.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: node env - -permissions: - contents: read - -jobs: - node-env: - runs-on: ubuntu-latest - needs: release - if: needs.release.outputs.release_created - steps: - - run: sudo timedatectl set-timezone Asia/Shanghai - - run: timedatectl - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version-file: .nvmrc - cache: npm - cache-dependency-path: '**/package-lock.json' diff --git a/.github/workflows/_node-env.yml b/.github/workflows/_node-env.yml new file mode 100644 index 0000000..e37648a --- /dev/null +++ b/.github/workflows/_node-env.yml @@ -0,0 +1,19 @@ +name: node env +description: 根据 .nvmrc 配置 node 环境 + +on: + workflow_call: + +jobs: + node-env: +runs: + runs-on: ubuntu-latest + steps: + - run: sudo timedatectl set-timezone Asia/Shanghai + - run: timedatectl + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version-file: .nvmrc + cache: npm + cache-dependency-path: '**/package-lock.json' diff --git a/.github/workflows/code-review.yml b/.github/workflows/code-review.yml index 959f244..5ef7f21 100644 --- a/.github/workflows/code-review.yml +++ b/.github/workflows/code-review.yml @@ -17,12 +17,12 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: ./.github/common-workflows/node-env.yml + - uses: ./.github/workflows/_node-env.yml - run: npm ci - run: npm run lint test: runs-on: ubuntu-latest steps: - - uses: ./.github/common-workflows/node-env.yml + - uses: ./.github/workflows/_node-env.yml - run: npm ci - run: npm run test diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index 5c8c808..06b9fdb 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -15,7 +15,7 @@ jobs: outputs: release_created: ${{ steps.release.outputs.release_created }} steps: - - uses: ./.github/common-workflows/node-env.yml + - uses: ./.github/workflows/_node-env.yml - uses: google-github-actions/release-please-action@v3 id: release with: @@ -27,7 +27,7 @@ jobs: needs: release if: needs.release.outputs.release_created steps: - - uses: ./.github/common-workflows/node-env.yml + - uses: ./.github/workflows/_node-env.yml - run: npm ci - run: npm run test - uses: codacy/codacy-coverage-reporter-action@v1 @@ -38,7 +38,7 @@ jobs: runs-on: ubuntu-latest needs: test steps: - - uses: ./.github/common-workflows/node-env.yml + - uses: ./.github/workflows/_node-env.yml - run: npm ci - run: npm run build - run: npm publish --registry=https://registry.npmjs.org