Fix partial record #354
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
| # .github/release.yml | |
| name: Release on npm | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - "packages/zod/package.json" | |
| - "packages/zod/src/**" | |
| - ".github/workflows/release.yml" | |
| jobs: | |
| build_and_publish: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: read | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| - run: pnpm install | |
| - run: pnpm build | |
| - run: pnpm test | |
| - run: pnpm run --filter @zod/resolution test:all | |
| - run: pnpm run prepublishOnly | |
| working-directory: ./packages/zod | |
| - id: publish | |
| name: Publish to NPM | |
| uses: JS-DevTools/npm-publish@v3 | |
| with: | |
| token: ${{ secrets.NPM_TOKEN }} | |
| # dry-run: true | |
| provenance: true | |
| package: ./packages/zod | |
| - run: pnpm jsr publish --allow-slow-types # --dry-run | |
| if: ${{ steps.publish.outputs.type }} | |
| working-directory: ./packages/zod | |
| - name: Post-publish | |
| if: ${{ steps.publish.outputs.type }} | |
| run: | | |
| echo "Published ${{ steps.publish.outputs.type }} version: ${{ steps.publish.outputs.version }}" | |
| - name: Set canary version | |
| if: ${{ !steps.publish.outputs.type }} | |
| working-directory: ./packages/zod | |
| run: | | |
| npm --no-git-tag-version version minor | |
| npm --no-git-tag-version version $(npm pkg get version | sed 's/"//g')-canary.$(date +'%Y%m%dT%H%M%S') | |
| - name: Publish canary | |
| if: ${{ !steps.publish.outputs.type }} | |
| uses: JS-DevTools/npm-publish@v3 | |
| with: | |
| token: ${{ secrets.NPM_TOKEN }} | |
| dry-run: false | |
| provenance: true | |
| tag: canary | |
| package: ./packages/zod | |
| - name: Done with canary | |
| if: ${{ !steps.publish.outputs.type }} | |
| run: | | |
| echo "Canary published." | |
| exit 0 | |
| - name: Configure changelog | |
| if: ${{ steps.publish.outputs.type }} | |
| run: | | |
| echo '{"categories": [], "template": "## Commits:\n\n${{ '${{UNCATEGORIZED}}' }}", "pr_template": ${{ '"- ${{MERGE_SHA}} ${{TITLE}}"' }} }' > changelog_config.json | |
| cat changelog_config.json | |
| echo "last_tag=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV | |
| echo "curr_commit=$(git rev-parse HEAD)" >> $GITHUB_ENV | |
| - name: Generate changelog | |
| if: ${{ steps.publish.outputs.type }} | |
| id: github_release | |
| uses: mikepenz/[email protected] | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| fromTag: "${{ env.last_tag }}" | |
| toTag: ${{ github.ref }} | |
| commitMode: true | |
| configuration: changelog_config.json | |
| - name: Create release | |
| if: ${{ steps.publish.outputs.type }} | |
| id: create_release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: v${{ steps.publish.outputs.version }} | |
| release_name: v${{ steps.publish.outputs.version }} | |
| commitish: ${{ github.ref }} | |
| body: ${{steps.github_release.outputs.changelog}} | |
| draft: false | |
| prerelease: false | |