Skip to content

Publish Package

Publish Package #4

Workflow file for this run

# 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
defaults:
run:
working-directory: packages/${{ inputs.package }}
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: Bump version
id: bump-version
run: |
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 }}
echo "GIT_TAG=${{ inputs.package }}-v$NEW_VERSION" >> "$GITHUB_OUTPUT"
- name: Publish to NPM
run: yarn publish-package
- name: Git Tag
run: |
TAG=${{ steps.bump-version.outputs.GIT_TAG }}
echo $TAG
git tag -a $TAG -m $TAG
git push origin $TAG
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
timeout-minutes: 15