Publish Package #3
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 }} | |
working-directory: packages/${{ inputs.package }} | |
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 and publish to NPM | |
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 |