Skip to content

Build & Publish

Build & Publish #7

Workflow file for this run

name: Build & Publish
on:
workflow_dispatch:
inputs:
release_as:
description: 'release as patch, minor, major or custom'
required: true
custom_version:
description: 'custom version'
required: false
jobs:
build-library:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup
uses: ./.github/actions/setup
- name: Build package
run: yarn prepack
publish:
runs-on: ubuntu-latest
needs: build-library
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configure Git committer
run: |
git config user.name "bmo-amity-bot"
git config user.email "developers@amity.co"
- name: Install Yarn
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'yarn'
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Clean dist directory
run: yarn run clean
- name: Increase version (patch)
run: npx standard-version --yes --release-as patch
if: github.event.inputs.release_as == 'patch'
- name: Increase version (minor)
run: npx standard-version --yes --release-as minor
if: github.event.inputs.release_as == 'minor'
- name: Increase version (major)
run: npx standard-version --yes --release-as major
if: github.event.inputs.release_as == 'major'
- name: Increase version (custom)
run: npx standard-version --yes --release-as ${{ github.event.inputs.custom_version }}
if: github.event.inputs.release_as == 'custom'
- name: Build package
run: yarn prepack
- uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://npm.pkg.github.com'
scope: '@ila-26'
- name: Publish package
run: npm publish --tag ${{ env.TAG }} --registry=https://npm.pkg.github.com/
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN }}
TAG: ${{ github.ref == 'refs/heads/main' && 'release' || github.ref == 'refs/heads/native' && 'dev' || startsWith(github.ref, 'refs/heads/release/') && 'pre-release' || 'custom' }}