Skip to content

Release

Release #110

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
release_type:
description: "The type of release (one of 'patch' or 'minor')"
required: true
default: patch
type: choice
options:
- patch
- minor
jobs:
build_release:
name: Build & release
runs-on: ubuntu-20.04
permissions:
contents: write
packages: write
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: "16.x"
registry-url: "https://npm.pkg.github.com"
- name: Install dependencies
env:
GITHUB_PACKAGES_PAT: ${{ secrets.GITHUB_TOKEN }}
run: yarn install --immutable
- name: Build
run: yarn run build
- name: Prepare release version
# This step runs if the trigger is run manually; the version is created by calling `yarn release`
if: ${{ ! github.event.after }}
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
npm version ${{ github.event.inputs.release_type }}
echo "release_version=`git describe`" >> $GITHUB_ENV
git push --follow-tags
- name: Publish npm package
run: yarn npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Create GitHub release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.release_version }}
release_name: Release ${{ env.release_version }}
draft: false
prerelease: false
- name: Build Storybook
run: yarn build-storybook
- name: Deploy Storybook
uses: JamesIves/[email protected]
with:
branch: gh-pages
folder: storybook-static # Source folder (output from build step)