-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
ci: changesets v3 & split release workflow #8051
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,63 +2,155 @@ name: Release | |
|
|
||
| on: | ||
| push: | ||
| branches: [main, '*-pre', '*-maint'] | ||
| # we do not support '*-maint' branches at this time | ||
| branches: [main, '*-pre'] | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: false | ||
|
|
||
| env: | ||
| NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't we need this? why did we have it? cc @beaussan
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's down there in the |
||
| SERVER_PRESET: 'node-server' | ||
|
|
||
| permissions: | ||
| contents: write | ||
| id-token: write | ||
| pull-requests: write | ||
| permissions: {} | ||
|
|
||
| jobs: | ||
| release: | ||
| name: Release | ||
| select-mode: | ||
| name: Select Mode | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 20 | ||
| outputs: | ||
| mode: ${{ steps.changesets.outputs.mode }} | ||
| publish-plan-artifact-id: ${{ steps.changesets.outputs.publish-plan-artifact-id }} | ||
| prerelease: ${{ steps.release-channel.outputs.prerelease }} | ||
| latest: ${{ steps.release-channel.outputs.latest }} | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| fetch-depth: 0 | ||
| persist-credentials: true # changesets/action pushes Release PR commits | ||
| persist-credentials: false | ||
| - name: Setup Tools | ||
| uses: TanStack/config/.github/setup@e4b48f16568324f76f467aa4c2aac2f05db632c3 # main | ||
| - name: Run Build | ||
| run: pnpm run build:all | ||
| - name: Enter Pre-Release Mode | ||
| if: "contains(github.ref_name, '-pre') && !hashFiles('.changeset/pre.json')" | ||
| run: pnpm changeset pre enter pre | ||
| - name: Determine dist-tag | ||
| id: dist-tag | ||
| - name: Determine Release Channel | ||
| id: release-channel | ||
| run: | | ||
| BRANCH="${GITHUB_REF_NAME}" | ||
| if [[ "$BRANCH" == *-pre ]]; then | ||
| if [[ "$GITHUB_REF_NAME" == *-pre ]]; then | ||
| echo "prerelease=true" >> "$GITHUB_OUTPUT" | ||
| elif [[ "$BRANCH" == *-maint ]]; then | ||
| echo "tag=maint" >> "$GITHUB_OUTPUT" | ||
| echo "latest=false" >> "$GITHUB_OUTPUT" | ||
| else | ||
| echo "prerelease=false" >> "$GITHUB_OUTPUT" | ||
| echo "latest=true" >> "$GITHUB_OUTPUT" | ||
| fi | ||
| - name: Create Release Pull Request or Publish | ||
| - name: Select Release Mode | ||
| id: changesets | ||
| uses: changesets/action@63a615b9cd06ba9a3e6d13796c7fbcb080a60a0b # v1.8.0 | ||
| uses: changesets/action/select-mode@22ccf9aa43179fe9e27dc62e575971d28cce197c # v2.0.0 | ||
|
|
||
| version: | ||
| name: Version | ||
| needs: select-mode | ||
| if: needs.select-mode.outputs.mode == 'version' | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 20 | ||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| version: pnpm run changeset:version | ||
| publish: pnpm run changeset:publish ${{ steps.dist-tag.outputs.tag && format('--tag {0}', steps.dist-tag.outputs.tag) }} | ||
| title: 'ci: Version Packages' | ||
| commit: 'ci: changeset release' | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| NODE_OPTIONS: --max-old-space-size=8192 | ||
| fetch-depth: 0 | ||
| persist-credentials: false | ||
| - name: Setup Tools | ||
| uses: TanStack/config/.github/setup@e4b48f16568324f76f467aa4c2aac2f05db632c3 # main | ||
| - name: Enter Pre-Release Mode | ||
| if: needs.select-mode.outputs.prerelease == 'true' && !hashFiles('.changeset/pre.json') | ||
| run: pnpm changeset pre enter pre | ||
| - name: Create or Update Release Pull Request | ||
| uses: changesets/action/version@22ccf9aa43179fe9e27dc62e575971d28cce197c # v2.0.0 | ||
| with: | ||
| github-token: ${{ github.token }} | ||
| script: pnpm run changeset:version | ||
| pr-title: 'ci: Version Packages' | ||
| commit-message: 'ci: changeset release' | ||
|
|
||
| pack: | ||
| name: Pack | ||
| needs: select-mode | ||
| if: needs.select-mode.outputs.mode == 'publish' | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 30 | ||
| env: | ||
| NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} | ||
| outputs: | ||
| pack-dir-artifact-id: ${{ steps.pack.outputs.pack-dir-artifact-id }} | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| persist-credentials: false | ||
| - name: Setup Tools | ||
| uses: TanStack/config/.github/setup@e4b48f16568324f76f467aa4c2aac2f05db632c3 # main | ||
| - name: Run Build | ||
| run: pnpm run build:all | ||
| - name: Pack Packages | ||
| id: pack | ||
| uses: changesets/action/pack@22ccf9aa43179fe9e27dc62e575971d28cce197c # v2.0.0 | ||
| with: | ||
| publish-plan-artifact-id: ${{ needs.select-mode.outputs.publish-plan-artifact-id }} | ||
|
|
||
| publish: | ||
| name: Publish to npm | ||
| needs: [select-mode, pack] | ||
| if: needs.select-mode.outputs.mode == 'publish' | ||
| runs-on: ubuntu-latest | ||
| environment: npm | ||
| timeout-minutes: 20 | ||
| outputs: | ||
| published: ${{ steps.publish.outputs.published }} | ||
| published-packages: ${{ steps.publish.outputs.published-packages }} | ||
| permissions: | ||
| contents: read | ||
| id-token: write | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| persist-credentials: false | ||
| - name: Setup Tools | ||
| uses: TanStack/config/.github/setup@e4b48f16568324f76f467aa4c2aac2f05db632c3 # main | ||
|
Comment on lines
+123
to
+124
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i wonder if we need this now. Why do we need tools if all we do is publish the artifacts that were built in the |
||
| - name: Publish Packed Packages | ||
| id: publish | ||
| uses: changesets/action/publish@22ccf9aa43179fe9e27dc62e575971d28cce197c # v2.0.0 | ||
| with: | ||
| pack-dir-artifact-id: ${{ needs.pack.outputs.pack-dir-artifact-id }} | ||
| create-github-releases: false | ||
| push-git-tags: false | ||
|
|
||
| release: | ||
| name: Create GitHub Release | ||
| needs: [select-mode, publish] | ||
| if: needs.publish.outputs.published == 'true' | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 20 | ||
| permissions: | ||
| contents: write | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| fetch-depth: 0 | ||
| persist-credentials: true # create-github-release pushes the aggregate release tag | ||
| - name: Setup Node | ||
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | ||
| with: | ||
| node-version: 24 | ||
| package-manager-cache: false | ||
| - name: Create GitHub Release | ||
| if: steps.changesets.outputs.published == 'true' | ||
| run: node scripts/create-github-release.mjs ${{ steps.dist-tag.outputs.prerelease == 'true' && '--prerelease' }} ${{ steps.dist-tag.outputs.latest == 'true' && '--latest' }} | ||
| run: node scripts/create-github-release.mjs ${{ needs.select-mode.outputs.prerelease == 'true' && '--prerelease' }} ${{ needs.select-mode.outputs.latest == 'true' && '--latest' }} | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| GITHUB_TOKEN: ${{ github.token }} | ||
| GH_TOKEN: ${{ github.token }} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,7 +44,7 @@ | |
| "format": "prettier --experimental-cli --ignore-unknown '**/*' --write", | ||
| "changeset": "changeset", | ||
| "changeset:publish": "changeset publish", | ||
| "changeset:version": "changeset version && node scripts/update-example-deps.mjs && pnpm install --lockfile-only --ignore-scripts --no-frozen-lockfile && pnpm format", | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why did we format here? are package.json misformatted maybe afterwards?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i'm not entirely sure what needed to get formatted before, but now |
||
| "changeset:version": "changeset version && node scripts/update-example-deps.mjs && pnpm install --lockfile-only --ignore-scripts --no-frozen-lockfile", | ||
| "gpt-generate": "node gpt/generate.js", | ||
| "set-ts-version": "node scripts/set-ts-version.js", | ||
| "labeler-generate": "node scripts/generate-labeler-config.ts", | ||
|
|
@@ -62,8 +62,8 @@ | |
| }, | ||
| "devDependencies": { | ||
| "@arethetypeswrong/cli": "^0.18.4", | ||
| "@changesets/changelog-github": "^0.7.0", | ||
| "@changesets/cli": "^2.30.0", | ||
| "@changesets/changelog-github": "^1.0.0", | ||
| "@changesets/cli": "^3.0.0", | ||
| "@eslint-react/eslint-plugin": "^1.26.2", | ||
| "@nx/devkit": "22.7.5", | ||
| "@playwright/test": "catalog:", | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the
-maintsuffix?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think it was meant for "maintenance" branches, but i'm not entirely sure