From c0d1b578437aa53851ae407a718371f314eb5791 Mon Sep 17 00:00:00 2001 From: dennisko Date: Sat, 6 Mar 2021 23:14:13 +0100 Subject: [PATCH] add release action --- .github/workflows/release.yml | 35 +++++++++++++++++++++++++++++++++++ package.json | 6 +++++- 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..2c4249e --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,35 @@ +name: Release + +on: + push: + branches: + - main + +jobs: + release: + name: Release + runs-on: ubuntu-latest + steps: + - name: Checkout Repo + uses: actions/checkout@master + 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 12.x + uses: actions/setup-node@master + with: + node-version: 12.x + + - name: Install Dependencies + run: yarn + + - name: Create Release Pull Request or Publish to npm + id: changesets + uses: changesets/action@master + with: + # This expects you to have a script called release which does a build for your packages and calls changeset publish + publish: yarn release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/package.json b/package.json index c5e321d..434eb87 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,9 @@ "module": "lib/index.esm.js", "author": "dennisko ", "license": "MIT", + "files": [ + "lib" + ], "devDependencies": { "@babel/core": "^7.13.8", "@changesets/cli": "^2.14.1", @@ -40,6 +43,7 @@ "build-storybook": "build-storybook", "test": "jest", "test:watch": "jest --watch", - "build": "rollup -c" + "build": "rollup -c", + "release": "yarn build && changeset publish" } }