chore: simplify release flow with changeset action

This commit is contained in:
Joren Broekema 2020-07-28 17:41:17 +02:00
parent 258ae817cd
commit 5cd2c3491c
2 changed files with 10 additions and 25 deletions

View file

@ -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 }}

View file

@ -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",