Skip to content

Publish new version #28

Publish new version

Publish new version #28

name: Publish new version
on:
workflow_dispatch:
inputs:
version:
required: true
env:
NODE_VERSION: 16.x
TOOLKIT_VERSION: ${{ inputs.version }}
jobs:
publish:
if: github.repository_owner == 'AxaFrance'
environment:
name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: 'https://registry.npmjs.org'
cache: 'npm'
- run: npm ci
- run: npm run build
- run: npm run check
- run: npm test -- --coverage
- name: Build storybook
run: npm run storybook:build
- name: Upload Storybook into workflow artifact
uses: actions/upload-artifact@v2
with:
name: storybook
path: storybook-static
- name: Publish release packages to npm
run: npx lerna publish from-git --yes --registry https://registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
deploy-storybook:
runs-on: ubuntu-latest
needs: publish
defaults:
run:
working-directory: gh-pages/react-toolkit
outputs:
previousVersion: ${{ steps.rename-latest-storybook.outputs.prevVersion }}
steps:
- name: Checkout Axa Github Pages
uses: actions/checkout@v2
with:
repository: AxaFrance/AxaFrance.github.io
ref: master
path: gh-pages
- name: Rename latest Storybook folder
id: rename-latest-storybook
run: |
prevVersion=`node -p "require('./latest/version.json').version"`
mv latest v$prevVersion
echo "::set-output name=prevVersion::$prevVersion"
- uses: actions/download-artifact@v2
with:
name: storybook
path: gh-pages/react-toolkit/latest
- name: Add version json file into latest
run: |
echo {\"version\":\"${TOOLKIT_VERSION#v}\"} >> ./latest/version.json
- name: Commit changes
run: |
git config user.name "Build-CI"
git config user.email [email protected]
git add .
git commit –m "docs(toolkit): publish storybook ${TOOLKIT_VERSION}"
git push