From 76f27450016c8823a811402ca2de62842515d119 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=AE=80=E9=9D=99=E5=87=A1?= <30424139+wtto00@users.noreply.github.com> Date: Sat, 23 Sep 2023 03:13:37 +0800 Subject: [PATCH] chore: github action ci --- .../workflows/npm-publish-github-packages.yml | 75 ------------------- .../workflows/{test.yml => test-publish.yml} | 4 +- 2 files changed, 3 insertions(+), 76 deletions(-) delete mode 100644 .github/workflows/npm-publish-github-packages.yml rename .github/workflows/{test.yml => test-publish.yml} (98%) diff --git a/.github/workflows/npm-publish-github-packages.yml b/.github/workflows/npm-publish-github-packages.yml deleted file mode 100644 index e5bd833..0000000 --- a/.github/workflows/npm-publish-github-packages.yml +++ /dev/null @@ -1,75 +0,0 @@ -# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created -# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages - -name: Publish Package - -on: - release: - types: [published] - -jobs: - PublishGithub: - runs-on: ubuntu-latest - name: Publish Github Package - permissions: - contents: read - packages: write - steps: - - name: Checkout Code - uses: actions/checkout@v3 - with: - ref: ${{ github.event.release.target_commitish }} - - - name: Install pnpm - uses: pnpm/action-setup@v2 - with: - version: 8 - run_install: false - - - name: Install Node - uses: actions/setup-node@v3 - with: - node-version: 20 - cache: 'pnpm' - registry-url: https://npm.pkg.github.com/ - - - name: Install Dependencies - run: pnpm install --no-frozen-lockfile - - - run: npm pkg set publishConfig.registry=https://npm.pkg.github.com - - run: npm publish - env: - NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} - - # publish to npm package - PublishNpm: - runs-on: ubuntu-latest - name: Publish Npm Package - steps: - - name: Checkout Code - uses: actions/checkout@v3 - with: - ref: ${{ github.event.release.target_commitish }} - - - name: Install pnpm - uses: pnpm/action-setup@v2 - with: - version: 8 - run_install: false - - - name: Install Node - uses: actions/setup-node@v3 - with: - node-version: 20 - cache: 'pnpm' - registry-url: https://registry.npmjs.org - - - name: Install Dependencies - run: pnpm install --no-frozen-lockfile - - - run: git config --global user.name "GitHub CD bot" - - run: git config --global user.email "github-cd-bot@example.com" - - run: npm publish --access public - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - NPM_CONFIG_PROVENANCE: true diff --git a/.github/workflows/test.yml b/.github/workflows/test-publish.yml similarity index 98% rename from .github/workflows/test.yml rename to .github/workflows/test-publish.yml index f1bb23d..6931bef 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test-publish.yml @@ -1,4 +1,4 @@ -name: 'Test' +name: 'TestPublish' on: pull_request: push: @@ -106,6 +106,8 @@ jobs: needs: Test if: startsWith(github.ref, 'refs/tags/v') name: Publish Npm Package + permissions: + id-token: write steps: - name: Checkout Code uses: actions/checkout@v3