Skip to content

chore(release): publish #1073

chore(release): publish

chore(release): publish #1073

Workflow file for this run

name: Publish
on:
push:
branches:
- main
jobs:
publish:
name: Build and publish npm packages with lerna
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: '0'
ref: 'main'
# Use personnel access token for bot account
token: ${{ secrets.GH_USER_PAT }}
- name: git config user
run: |
git config user.email "designsystem@sparebank1.no"
git config user.name "sb1-designsystem"
- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: 'https://registry.npmjs.com'
- run: |
npm install
echo "$GITHUB_WORKSPACE/node_modules/.bin/" >> $GITHUB_PATH
- name: lerna changed
id: lerna-changed
run: echo "CHANGED_COUNT=$(lerna changed|wc -l)" >> $GITHUB_OUTPUT
- name: Build packages
if: ${{ steps.lerna-changed.outputs.CHANGED_COUNT > 0 }}
run: |
npm run build
npm run lint
npm test -- --ci
- name: lerna publish to registry.npmjs.com
if: ${{ steps.lerna-changed.outputs.CHANGED_COUNT > 0 }}
run: lerna publish --yes --no-verify-access --force-git-tag --create-release github
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
GH_TOKEN: ${{ secrets.GH_USER_PAT }}
- name: Merge back changes to development branch
if: ${{ steps.lerna-changed.outputs.CHANGED_COUNT > 0 }}
run: |
git checkout develop
git pull
git merge -X theirs --no-edit main
git push origin develop
git push --tags
- name: Build storybook
if: ${{ steps.lerna-changed.outputs.CHANGED_COUNT > 0 }}
run: |
npm run build
npm run build-storybook
- name: Deploy storybook as gh-pages
if: ${{ steps.lerna-changed.outputs.CHANGED_COUNT > 0 }}
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: storybook-static
branch: gh-pages
token: ${{ secrets.GH_USER_PAT }}