Merge pull request #210 from 0xObsidian/0xObsidian/error-handling-in-… #50
This file contains hidden or 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
| name: Version & Publish Packages | |
| on: | |
| workflow_dispatch: | |
| branches: | |
| - main | |
| push: | |
| branches: | |
| - main | |
| 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: Run Build Step | |
| run: pnpm build | |
| - 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 }} | |
| - name: Choose Build Step | |
| id: build-step-decider | |
| run: | |
| echo "step-name=${{ steps.changesets.outputs.hasChangesets == 'false' && 'publish-packages' || 'build' }}" >> | |
| $GITHUB_OUTPUT | |
| - name: Run Build Step | |
| run: pnpm ${{ steps.build-step-decider.outputs.step-name }} | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |