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: push:
branches: branches:
- master - master
paths:
- '.changeset/*.md'
jobs: jobs:
release: release:
if: github.repository == 'ing-bank/lion'
name: Release name: Release
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -22,31 +21,16 @@ jobs:
uses: actions/setup-node@master uses: actions/setup-node@master
with: with:
node-version: 12.x node-version: 12.x
registry-url: 'https://registry.npmjs.org'
- name: Install Dependencies - name: Install Dependencies
run: yarn run: yarn
- name: Build - name: Create Release Pull Request or Publish to npm
run: yarn build:types id: changesets
uses: changesets/action@master
- name: Changeset version with:
run: yarn changeset version # This expects you to have a script called release which does a build for your packages and calls changeset publish
publish: yarn release
- 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
env: env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: yarn changeset publish NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Push commits and tags to GitHub
run: git push https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY} --follow-tags

View file

@ -20,6 +20,7 @@
"lint:prettier": "prettier \"**/*.js\" --list-different || (echo '↑↑ these files are not prettier formatted ↑↑' && exit 1)", "lint:prettier": "prettier \"**/*.js\" --list-different || (echo '↑↑ these files are not prettier formatted ↑↑' && exit 1)",
"lint:types": "tsc", "lint:types": "tsc",
"lint:versions": "node ./scripts/lint-versions.js", "lint:versions": "node ./scripts/lint-versions.js",
"release": "npm run build:types && npm run build:docs && changeset release",
"start": "npm run storybook", "start": "npm run storybook",
"storybook": "start-storybook -p 9001", "storybook": "start-storybook -p 9001",
"storybook:build": "build-storybook", "storybook:build": "build-storybook",