Skip to content

Publish Package

Publish Package #2

# Bump version and release a specific package to NPM
# https://github.com/department-of-veterans-affairs/va-mobile-app/actions/workflows/on_demand_build.yml
name: 'Publish Package'
on:
workflow_dispatch:
inputs:
package:
description: Package
required: true
type: choice
options:
- components
- tokens
version_bump:
description: Version bump
required: true
type: choice
options:
- alpha
- beta
- patch
- minor
- major
jobs:
publish-package:
runs-on: ubuntu-latest
env:
YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_KEY }}
steps:
- uses: actions/checkout@v4
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- run: yarn install
- name: Install dependencies in components
run: yarn install
- name: Bump version and publish to NPM
run: |
cd packages/${{ inputs.package }}
NPM_PACKAGE=$(jq -r .name package.json)
echo "NPM Package name: $NPM_PACKAGE"
LATEST_VERSION=$(npm view $NPM_PACKAGE version)
echo "Latest NPM version: $LATEST_VERSION"
npm version ${{ inputs.version_bump }}
NEW_VERSION=$(jq -r .version package.json)
GIT_TAG="${{ inputs.package }}-v$NEW_VERSION"
echo $GIT_TAG
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
timeout-minutes: 15