Publish Packages #14
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: Publish Packages | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| inputs: | |
| dry_run: | |
| description: 'Dry run (skip actual publish)' | |
| required: false | |
| default: 'false' | |
| type: boolean | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| name: Version and Publish to npm | |
| # Skip if commit is from the CI bot (version bump commits) | |
| if: "!contains(github.event.head_commit.message, 'chore(release):')" | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Configure Git | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'pnpm' | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| # TODO: Enable typecheck and tests once existing issues are fixed | |
| # - name: Run type check | |
| # run: pnpm typecheck | |
| # - name: Run tests | |
| # run: pnpm test | |
| - name: Build all packages | |
| # TODO: Re-enable gello-queue once queue-worker build issue is fixed | |
| run: pnpm nx run-many -t build --projects='gello-*' --exclude='gello-queue' | |
| - name: Version and publish packages (dry run) | |
| if: ${{ inputs.dry_run == 'true' }} | |
| run: pnpm nx run-many -t version --projects='gello-*' --exclude='gello-queue' -- --dry-run | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Version and publish packages | |
| if: ${{ inputs.dry_run != 'true' }} | |
| run: pnpm nx run-many -t version --projects='gello-*' --exclude='gello-queue' --parallel=1 | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Push version commits and tags | |
| if: ${{ inputs.dry_run != 'true' }} | |
| run: | | |
| git push origin main --follow-tags |