From 5cd2c3491cbbdf032e15a43939ba057193434a68 Mon Sep 17 00:00:00 2001 From: Joren Broekema Date: Tue, 28 Jul 2020 17:41:17 +0200 Subject: [PATCH] chore: simplify release flow with changeset action --- .github/workflows/release.yml | 34 +++++++++------------------------- package.json | 1 + 2 files changed, 10 insertions(+), 25 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a2f80dbe2..83b6d719a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,11 +4,10 @@ on: push: branches: - master - paths: - - '.changeset/*.md' jobs: release: + if: github.repository == 'ing-bank/lion' name: Release runs-on: ubuntu-latest steps: @@ -22,31 +21,16 @@ jobs: uses: actions/setup-node@master with: node-version: 12.x - registry-url: 'https://registry.npmjs.org' - name: Install Dependencies run: yarn - - name: Build - run: yarn build:types - - - name: Changeset version - run: yarn changeset version - - - name: Format - run: yarn format - - - name: Commit version updates - run: | - git config --local user.email "lion@ing.com" - git config --local user.name "Lion Bot" - - run: git add . - - run: "git commit -m 'chore: release new versions'" - - - name: Release to NPM + - 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: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - run: yarn changeset publish - - - name: Push commits and tags to GitHub - run: git push https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY} --follow-tags + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/package.json b/package.json index 08135484e..dc1e083fd 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "lint:prettier": "prettier \"**/*.js\" --list-different || (echo '↑↑ these files are not prettier formatted ↑↑' && exit 1)", "lint:types": "tsc", "lint:versions": "node ./scripts/lint-versions.js", + "release": "npm run build:types && npm run build:docs && changeset release", "start": "npm run storybook", "storybook": "start-storybook -p 9001", "storybook:build": "build-storybook",