From 0dd5dcfe8be568e0217bea924f1462152dc2b4ec Mon Sep 17 00:00:00 2001 From: yosuke ota Date: Tue, 30 Aug 2022 19:59:38 +0900 Subject: [PATCH] chore: add changesets release action --- .github/workflows/NpmPublish.yml | 28 ------------------------ .github/workflows/Release.yml | 37 ++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 28 deletions(-) delete mode 100644 .github/workflows/NpmPublish.yml create mode 100644 .github/workflows/Release.yml diff --git a/.github/workflows/NpmPublish.yml b/.github/workflows/NpmPublish.yml deleted file mode 100644 index 436b1d2f..00000000 --- a/.github/workflows/NpmPublish.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: publish -on: - push: - tags: - - "*" -jobs: - release: - name: check version, and release - runs-on: ubuntu-latest - steps: - - name: checkout - uses: actions/checkout@v3 - - name: setup Node - uses: actions/setup-node@v3 - with: - registry-url: "https://registry.npmjs.org" - - name: Install Packages - run: yarn install - - name: test and build - run: | - yarn build - yarn test - - name: check can npm-publish - run: npx can-npm-publish - - name: release - run: npm publish - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml new file mode 100644 index 00000000..a5da1f91 --- /dev/null +++ b/.github/workflows/Release.yml @@ -0,0 +1,37 @@ +name: Release + +on: + push: + branches: + - main + +jobs: + release: + name: Release + runs-on: ubuntu-latest + steps: + - name: Checkout Repo + uses: actions/checkout@v3 + with: + # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits + fetch-depth: 0 + + - name: Setup Node.js 16 + uses: actions/setup-node@v3 + with: + node-version: 16 + + - name: Install Dependencies + run: yarn + + - name: Create Release Pull Request or Publish to npm + id: changesets + uses: changesets/action@v1 + with: + # This expects you to have a script called release which does a build for your packages and calls changeset publish + publish: yarn release + commit: "chore: release svelte-eslint-parser" + title: "chore: release svelte-eslint-parser" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }}