Skip to content

Version & Publish Package #5

Version & Publish Package

Version & Publish Package #5

name: Version & Publish Package
on:
workflow_dispatch:
branches:
- master
push:
branches:
- master
env:
# See https://consoledonottrack.com/
DO_NOT_TRACK: "1"
jobs:
build-and-publish-to-npm:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Dependencies
uses: ./.github/workflows/actions/install-dependencies
- name: Configure NPM token
run: |
pnpm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Create Changesets Pull Request or Trigger an NPM Publish
id: changesets
uses: changesets/action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# This expects you to have a script called release which does a build for your packages and calls changeset publish
publish: pnpm changeset:publish
# - name: Push Git Tag
# if: steps.changesets.outputs.hasChangesets == 'false'
# run: |
# VERSION_TAG=v$(cd packages/library/ && pnpm pkg get version | sed -n '2p' | grep -o '"\([^"]\)\+"$' | tr -d \")
# if ! git ls-remote --tags | grep -q "$VERSION_TAG"; then git tag $VERSION_TAG && git push --tags; fi
# env:
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}