Skip to content

fix: More fixes for npm trusted publishing (#356) #605

fix: More fixes for npm trusted publishing (#356)

fix: More fixes for npm trusted publishing (#356) #605

name: Test and Build
on:
push:
branches: ['main']
pull_request:
branches: ['main']
jobs:
test-and-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- run: pnpm install
- name: Build z
run: cd packages/z && pnpm build
- name: Test z
run: cd packages/z && pnpm test
- name: Test nestjs-zod
run: cd packages/nestjs-zod && pnpm test
- name: Build nestjs-zod
run: cd packages/nestjs-zod && pnpm build
- name: Build example-dual-zods app
run: cd packages/example-dual-zods && pnpm run build
- name: Test example-dual-zods app
run: cd packages/example-dual-zods && pnpm run test
- name: Build example app
run: cd packages/example && pnpm build
- name: Test example app
run: cd packages/example && pnpm test
- name: Build example-esm app
run: cd packages/example-esm && pnpm build
- name: Cache Playwright Browsers
id: playwright-cache
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: playwright-${{ runner.os }}-${{ hashFiles('packages/example-dual-zods/package.json') }}-${{ hashFiles('packages/example/package.json') }}-${{ hashFiles('packages/example-esm/package.json') }}
restore-keys: |
playwright-${{ runner.os }}-
- name: Install Playwright Browsers
if: steps.playwright-cache.outputs.cache-hit != 'true'
run: cd packages/example-dual-zods && pnpm exec playwright install --with-deps
- name: Test example-dual-zods app swagger
run: |
cd packages/example-dual-zods && pnpm run start &
cd packages/example-dual-zods && pnpm run test:swagger
- name: Test example app swagger
run: |
cd packages/example && pnpm run start &
cd packages/example && pnpm run test:swagger
- name: Test example-esm app swagger
run: |
cd packages/example-esm && pnpm run start &
cd packages/example-esm && pnpm run test:swagger
merge-if-dependabot-pr:
runs-on: ubuntu-latest
needs: test-and-build
if: github.event_name == 'pull_request' && github.event.pull_request.user.login == 'dependabot[bot]'
permissions:
contents: write
pull-requests: write
steps:
- name: Merge if dependabot PR
run: gh pr merge --squash "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
# - name: Get current date
# if: github.head_ref == 'v5'
# id: date
# run: echo "date=$(date -u +'%Y%m%dT%H%M%S')" >> $GITHUB_OUTPUT
# - name: Set beta version
# if: github.head_ref == 'v5'
# uses: reedyuk/npm-version@1.1.1
# with:
# version: 5.0.0-beta.${{ steps.date.outputs.date }}
# package: 'packages/nestjs-zod'
# - name: Publish beta version
# if: github.head_ref == 'v5'
# env:
# NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
# run: |
# cd packages/nestjs-zod
# npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN
# npm publish --tag next