From 63c0b5b74c9886f064651bbba0fd360d3af58978 Mon Sep 17 00:00:00 2001 From: JacobLinCool Date: Mon, 11 Sep 2023 21:51:10 +0800 Subject: [PATCH] ci: update pnpm action and release workflow --- .github/workflows/docs.yml | 6 ++-- .github/workflows/release.yml | 66 +++++++++-------------------------- .github/workflows/test.yml | 6 ++-- 3 files changed, 23 insertions(+), 55 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 66df3c5..b4902b4 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -16,12 +16,12 @@ jobs: uses: actions/checkout@v3 - name: Setup PNPM - uses: pnpm/action-setup@v2.2.2 + uses: pnpm/action-setup@v2.4.0 with: - version: latest + run_install: true - name: Build Docs - run: pnpm i && pnpm run docs + run: pnpm run docs - name: Deploy uses: peaceiris/actions-gh-pages@v3 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e878cbe..1c8b135 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,62 +10,30 @@ jobs: release-npm: name: Release NPM (${{ github.ref }}) runs-on: ubuntu-latest + permissions: + contents: write + issues: write + pull-requests: write steps: - name: Checkout Repository uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Check if Tag on Main - run: | - git checkout main - branch=$(git branch main --contains ${{ github.ref }}) - git checkout ${{ github.ref }} - if [ -z $branch ]; then - echo "Tag ${{ github.ref }} is not contained in the main branch." - exit 1 - fi - name: Setup PNPM - uses: pnpm/action-setup@v2.2.2 + uses: pnpm/action-setup@v2.4.0 with: - version: latest run_install: true - - name: Build & Test - run: pnpm build && pnpm test - - - name: Publish - run: | - pnpm config set //registry.npmjs.org/:_authToken ${{ secrets.NPM_TOKEN }} - pnpm publish --verbose --no-git-checks - - release-note: - name: Release Note (${{ github.ref }}) - runs-on: ubuntu-latest - needs: - - release-npm - steps: - - name: Checkout Repository - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Check if Tag on Main - run: | - git checkout main - branch=$(git branch main --contains ${{ github.ref }}) - git checkout ${{ github.ref }} - if [ -z $branch ]; then - echo "Tag ${{ github.ref }} is not contained in the main branch." - exit 1 - fi + - name: Build + run: pnpm build - - name: Publish Release - uses: "marvinpinto/action-automatic-releases@latest" + - name: Create Release Pull Request or Publish to NPM + id: changesets + uses: changesets/action@v1 with: - repo_token: "${{ secrets.GH_TOKEN }}" - prerelease: false - files: | - README.md - LICENSE + publish: pnpm changeset publish + version: pnpm changeset version + title: Release Packages + commit: bump versions + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b83eb2f..f9bb62d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -29,12 +29,12 @@ jobs: uses: actions/checkout@v3 - name: Setup PNPM - uses: pnpm/action-setup@v2.2.2 + uses: pnpm/action-setup@v2.4.0 with: - version: latest + run_install: true - name: Build - run: pnpm i && pnpm build + run: pnpm build - name: Test (w/ service) run: sudo -E $PNPM_HOME/pnpm test