From 08509fb7482a465949fb5b6f92432dcf91cccc20 Mon Sep 17 00:00:00 2001 From: fi3ework Date: Thu, 16 May 2024 18:01:15 +0800 Subject: [PATCH] ci: add release workflow --- .github/workflows/release.yaml | 42 ++++++++++++++++++++++++++++++++++ .npmrc | 3 ++- 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..1c38507 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,42 @@ +# .github/workflows/release.yml + +name: Release + +permissions: + contents: write + +on: + push: + tags: + - 'v*' + +jobs: + release: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup npmrc + run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> .npmrc + + - name: Install Pnpm + run: corepack enable + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + cache: 'pnpm' + + - name: Install Dependencies and build + run: pnpm install + + - name: Publish to NPM + run: | + pnpm changeset publish + git push --follow-tags + + - name: GitHub Release + run: pnpx changelogithub + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/.npmrc b/.npmrc index 3d358ff..bb57281 100644 --- a/.npmrc +++ b/.npmrc @@ -1 +1,2 @@ -hoist-pattern[]=@mdx-js/loader +registry = 'https://registry.npmjs.org/' +hoist-pattern[]=[]