Compare commits

..
Author SHA1 Message Date
changeset-internal-publish-bot[bot] 74169fc1c6 v2.0.0-next.5 2026-08-11 11:15:06 +00:00
changesets-org-version-bot[bot] d11394aa52 Version Packages (next) (#712)
Co-authored-by: changesets-org-version-bot[bot] <288406890+changesets-org-version-bot[bot]@users.noreply.github.com>
2026-08-11 11:05:26 +00:00
Mateusz Burzyński 5fa67671df Fix support for prerelease exits using the new .changeset/pre layout (#711)
* Fix prerelease exit mode selection

* Improve prerelease exit changeset wording
2026-08-11 11:00:37 +00:00
Mateusz Burzyński cae6353519 Use new self-repository syntax for local GitHub actions (#706) 2026-08-03 15:40:56 +00:00
46 changed files with 643 additions and 375 deletions
+1 -23
View File
@@ -1,26 +1,4 @@
{
"mode": "pre",
"tag": "next",
"changesets": [
"all-cars-grin",
"brave-pandas-commit",
"bright-lions-check",
"calm-files-warn",
"chubby-geese-sink",
"eight-clocks-pull",
"eighty-doors-swim",
"eighty-parks-tickle",
"fiery-toes-vanish",
"git-cli-auth-header",
"git-cli-server-url",
"green-birds-push",
"lemon-turtles-itch",
"ready-mangos-boil",
"shaky-rings-type",
"shy-months-crash",
"silent-tips-dance",
"strict-hotels-laugh",
"tidy-bots-smile",
"yellow-roses-fix"
]
"tag": "next"
}
+5
View File
@@ -0,0 +1,5 @@
---
"@changesets/action": patch
---
Fix support for prerelease exits using the new `.changeset/pre` layout.
+5
View File
@@ -10,6 +10,11 @@ inputs:
runs:
using: composite
steps:
- name: Check out repo
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- name: Set up pnpm
uses: pnpm/action-setup@8912a9102ac27614460f54aedde9e1e7f9aec20d # v6.0.5
+4 -19
View File
@@ -32,7 +32,7 @@ jobs:
persist-credentials: false
- name: Run zizmor
uses: zizmorcore/zizmor-action@5f14fd08f7cf1cb1609c1e344975f152c7ee938d # v0.5.6
uses: zizmorcore/zizmor-action@3dc1ecc9bcb9e94e9b2c709687979e1298497054 # v0.6.2
with:
persona: pedantic
annotations: true
@@ -43,12 +43,7 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Check out repo
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- uses: ./.github/actions/ci-setup
- uses: $/.github/actions/ci-setup
- name: Test
run: pnpm test
@@ -58,12 +53,7 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Check out repo
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- uses: ./.github/actions/ci-setup
- uses: $/.github/actions/ci-setup
- name: Typecheck
run: pnpm typecheck
@@ -73,12 +63,7 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Check out repo
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- uses: ./.github/actions/ci-setup
- uses: $/.github/actions/ci-setup
- name: Format
run: pnpm format
+5 -20
View File
@@ -24,12 +24,7 @@ jobs:
permissions:
contents: read # to check out repo (actions/checkout)
steps:
- name: Check out repo
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- uses: ./.github/actions/ci-setup
- uses: $/.github/actions/ci-setup
with:
skip-cache: true # avoid cache poisoning attacks
@@ -50,19 +45,14 @@ jobs:
permissions:
contents: read # to check out repo (actions/checkout)
steps:
- name: Check out repo
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- uses: ./.github/actions/ci-setup
- uses: $/.github/actions/ci-setup
with:
skip-cache: true # avoid cache poisoning attacks
- name: Build
run: pnpm build
- uses: ./.github/actions/setup-bot-auth
- uses: $/.github/actions/setup-bot-auth
id: bot-auth
with:
client-id: ${{ vars.APP_CLIENT_ID }}
@@ -87,19 +77,14 @@ jobs:
permissions:
contents: write # to create release and have it authored by github-actions (changesets/action)
steps:
- name: Check out repo
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- uses: ./.github/actions/ci-setup
- uses: $/.github/actions/ci-setup
with:
skip-cache: true # avoid cache poisoning attacks
- name: Build
run: pnpm build
- uses: ./.github/actions/setup-bot-auth
- uses: $/.github/actions/setup-bot-auth
id: bot-auth
with:
client-id: ${{ vars.APP_CLIENT_ID }}
+2 -7
View File
@@ -122,12 +122,7 @@ jobs:
pull-requests: write # to comment on the pull request with the release result (changesets/action)
steps:
- name: Check out repo
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- uses: ./.github/actions/ci-setup
- uses: $/.github/actions/ci-setup
with:
skip-cache: true # avoid cache poisoning attacks
@@ -166,7 +161,7 @@ jobs:
- name: Build
run: pnpm build
- uses: ./.github/actions/setup-bot-auth
- uses: $/.github/actions/setup-bot-auth
id: bot-auth
with:
client-id: ${{ vars.APP_CLIENT_ID }}
+6
View File
@@ -1,5 +1,11 @@
# @changesets/action
## 2.0.0-next.5
### Patch Changes
- [#711](https://github.com/changesets/action/pull/711) [`5fa6767`](https://github.com/changesets/action/commit/5fa67671df41b7a8a9d8123e8e446b1a8ad423db) Thanks [@Andarist](https://github.com/Andarist)! - Fix support for prerelease exits using the new `.changeset/pre` layout.
## 2.0.0-next.4
### Major Changes
+12
View File
File diff suppressed because one or more lines are too long
+1
View File
@@ -0,0 +1 @@
import{A as e,D as t,E as n,O as r,f as i,j as a,k as o,m as s,o as c,p as l,s as u}from"./utils-C998F5Ty.js";import{n as d,r as f,t as p}from"./run-CrnFHRGT.js";import{t as m}from"./readChangesetState-DSLewpir.js";(async()=>{let h=process.cwd();await s(h),l({publish:`publish-script`,version:`version-script`,commit:`commit-mesage`,title:`pr-title`,branch:`pr-base-branch`,prDraft:`pr-draft`,createGithubReleases:`create-github-releases`}),i();let g=u(`github-token`);if(process.env.GITHUB_TOKEN&&process.env.GITHUB_TOKEN!==g)throw Error(`The GITHUB_TOKEN environment variable is set and does not match the "github-token" input. Please pass the custom GitHub token to the "github-token" input and remove the GITHUB_TOKEN environment variable to avoid conflicts.`);let _=t(`push-with-git-cli`),v=c(`pr-draft`);if(v!==void 0&&v!==`always`&&v!==`create`){e(`Invalid pr-draft: ${v}`);return}let y=new f({cwd:h,githubToken:g,pushWithGitCli:_}),{changesets:b}=await m(h),x=r(`publish-script`),S=b.length!==0,C=b.some(e=>e.releases.length>0),w=!!x;switch(a(`published`,`false`),a(`published-packages`,`[]`),a(`has-changesets`,String(S)),!0){case!S&&!w:o(`No changesets present or were removed by merging release PR. Not publishing because no publish script found.`);return;case!S&&w:{o(`No changesets found. Attempting to publish any unpublished packages to npm`);let e=t(`create-github-releases`),r=t(`push-git-tags`);if(e&&!r)throw Error(`The input 'create-github-releases' is set to true, but 'push-git-tags' is set to false. Creating GitHub releases requires pushing git tags. Please set 'push-git-tags' to true or set 'create-github-releases' to false.`);let i=await p({script:x,github:y,createGithubReleases:e,pushGitTags:r,cwd:h});i.published&&(a(`published`,`true`),a(`published-packages`,JSON.stringify(i.publishedPackages))),i.exitCode!==0&&(n(`Publish command exited with code ${i.exitCode}${i.published?`, but some packages were published: ${i.publishedPackages.map(e=>`${e.name}@${e.version}`).join(`, `)}`:``}`),process.exit(i.exitCode));return}case S&&!C:o(`All changesets are empty; not creating PR`);return;case S:{let{pullRequestNumber:e}=await d({script:c(`version-script`),github:y,cwd:h,prTitle:c(`pr-title`),commitMessage:c(`commit-message`),hasPublishScript:w,prDraft:v,branch:c(`pr-base-branch`)});a(`pr-number`,String(e));return}}})().catch(t=>{n(t),e(t.message)});export{};
+1
View File
@@ -0,0 +1 @@
import{A as e,j as t,m as n,n as r,o as i,t as a,y as o}from"./utils-C998F5Ty.js";import s from"node:fs/promises";import c from"node:path";import l from"node:os";try{await u()}catch(t){e(t.message)}async function u(){let e=process.cwd();await n(e);let r=i(`publish-plan-artifact-id`),a=process.env.RUNNER_TEMP??await s.realpath(l.tmpdir()),u=c.join(a,`changeset-pack-${Date.now()}`);await d(e,{outDir:u,publishPlanPath:r?await f(a,Number(r)):void 0});let m=await o.uploadArtifact(`changeset-pack-${Date.now()}`,await p(u),u,{retentionDays:30});if(m.id===void 0)throw Error(`Packed artifact upload did not return an artifact id`);t(`pack-dir-artifact-id`,String(m.id))}async function d(e,t){let n=[`pack`,`--out-dir`,t.outDir];t.publishPlanPath&&n.push(`--from-publish-plan`,t.publishPlanPath),await r(n,{cwd:e,env:process.env})}async function f(e,t){let n=await a(e,t,`changeset-publish-plan`);return c.join(n,`publish-plan.json`)}async function p(e){let t=await s.readdir(e,{withFileTypes:!0});return(await Promise.all(t.map(async t=>{let n=c.join(e,t.name);return t.isDirectory()?p(n):[n]}))).flat()}export{};
+1
View File
@@ -0,0 +1 @@
import{A as e,T as t,j as n,k as r,o as i,s as a,w as o}from"./utils-C998F5Ty.js";try{await s()}catch(t){e(t.message)}async function s(){let e=o.payload.pull_request;if(!e)throw Error("This action should only be run on `pull_request_target` or `pull_request` events");let s=a(`github-token`),l=a(`body`),u=i(`update-id`),d=u?c(u):null,f=d?`${d}\n\n${l}`:l,p={repo:e.base.repo.name,owner:e.base.repo.owner.login,issue_number:e.number,body:f},m=t(s),h;d&&(r(`Checking for existing comment...`),h=await m.rest.issues.listComments({repo:e.base.repo.name,owner:e.base.repo.owner.login,issue_number:e.number}).then(e=>e.data.find(e=>e.body?.includes(d))?.id)),h?(r(`Updating existing comment (id: ${h})...`),await m.rest.issues.updateComment({...p,comment_id:h}),n(`comment-id`,h)):(r(`Creating new comment...`),n(`comment-id`,(await m.rest.issues.createComment(p)).data.id)),r(`Done!`)}function c(e){let t=`changesets-action-pr-comment`;return t===e?`<!-- ${t} -->`:`<!-- ${t}:${e} -->`}export{};
+38
View File
File diff suppressed because one or more lines are too long
+1
View File
@@ -0,0 +1 @@
import{A as e,D as t,j as n,m as r,o as i,s as a,t as o}from"./utils-C998F5Ty.js";import{r as s,t as c}from"./run-CrnFHRGT.js";import l from"node:fs/promises";import u from"node:os";try{await d()}catch(t){e(t.message)}async function d(){let e=process.cwd();await r(e);let d=a(`github-token`),f=i(`script`),p=i(`pack-dir-artifact-id`),m=t(`create-github-releases`),h=t(`push-git-tags`);if(m&&!h)throw Error(`The input 'create-github-releases' is set to true, but 'push-git-tags' is set to false. Creating GitHub releases requires pushing git tags. Please set 'push-git-tags' to true or set 'create-github-releases' to false.`);let g=await c({script:f,github:new s({cwd:e,githubToken:d}),createGithubReleases:m,pushGitTags:h,cwd:e,fromPackDir:p?await o(process.env.RUNNER_TEMP??await l.realpath(u.tmpdir()),Number(p),`changeset-pack`):void 0});if(g.published?(n(`published`,`true`),n(`published-packages`,JSON.stringify(g.publishedPackages))):n(`published`,`false`),g.exitCode!==0)throw Error(`Publish command exited with code ${g.exitCode}${g.published?`, but some packages were published: ${g.publishedPackages.map(e=>`${e.name}@${e.version}`).join(`, `)}`:``}`)}export{};
+1
View File
@@ -0,0 +1 @@
import{i as e,t}from"./dist-DlzQ-3f_.js";async function n(n=process.cwd()){let r=await e(n),i=await t(n);return r!==void 0&&r.mode===`pre`?{preState:r,changesets:i.filter(e=>!e.id.startsWith(`pre/`))}:{preState:void 0,changesets:i}}export{n as t};
+98
View File
File diff suppressed because one or more lines are too long
+1
View File
@@ -0,0 +1 @@
import{A as e,j as t,m as n,n as r,y as i}from"./utils-C998F5Ty.js";import{t as a}from"./readChangesetState-DSLewpir.js";import o from"node:fs/promises";import s from"node:path";import c from"node:os";try{await l()}catch(t){e(t.message)}async function l(){let e=process.cwd();await n(e);let r=await u(e);if(t(`mode`,r.mode),r.mode===`publish`){let e=await i.uploadArtifact(s.basename(r.publishPlanPath,`.json`),[r.publishPlanPath],s.dirname(r.publishPlanPath),{skipArchive:!0,retentionDays:30});if(e.id===void 0)throw Error(`Publish plan artifact upload did not return an artifact id`);t(`publish-plan-artifact-id`,String(e.id))}}async function u(e){let{changesets:t}=await a(e);if(t.length>0)return t.some(e=>e.releases.length>0)?{mode:`version`}:{mode:`none`};let n=s.join(process.env.RUNNER_TEMP??await o.realpath(c.tmpdir()),`changeset-publish-plan-${Date.now()}`,`publish-plan.json`);return await r([`publish-plan`,`--output`,n],{cwd:e,env:process.env}),(await d(n)).length===0?{mode:`none`}:{mode:`publish`,publishPlanPath:n}}async function d(e){let t;try{t=await o.readFile(e,`utf8`)}catch(t){throw Error(`Failed to read publish plan at ${e}`,{cause:t})}let n;try{n=JSON.parse(t)}catch(t){throw Error(`Failed to parse publish plan at ${e}`,{cause:t})}if(typeof n!=`object`||!n||!(`version`in n)||typeof n.version!=`number`||!(`plan`in n)||!Array.isArray(n.plan))throw Error(`Invalid publish plan at ${e}: expected { version: number; plan: unknown[] }`);return n.plan}export{};
+224
View File
File diff suppressed because one or more lines are too long
+1
View File
@@ -0,0 +1 @@
import{A as e,D as t,f as n,j as r,m as i,o as a,s as o}from"./utils-C998F5Ty.js";import{n as s,r as c}from"./run-CrnFHRGT.js";try{await l()}catch(t){e(t.message)}async function l(){let e=process.cwd();await i(e),n();let l=o(`github-token`),u=a(`script`),d=o(`commit-message`),f=o(`pr-title`),p=a(`pr-draft`),m=a(`pr-base-branch`),h=t(`push-with-git-cli`);if(p!==void 0&&p!==`always`&&p!==`create`)throw Error(`Invalid pr-draft input: ${p}`);let{pullRequestNumber:g}=await s({script:u,github:new c({cwd:e,githubToken:l,pushWithGitCli:h}),cwd:e,prTitle:f,commitMessage:d,hasPublishScript:!0,prDraft:p,branch:m});r(`pr-number`,String(g))}export{};
+9 -9
View File
@@ -1,6 +1,6 @@
{
"name": "@changesets/action",
"version": "2.0.0-next.4",
"version": "2.0.0-next.5",
"private": true,
"license": "MIT",
"type": "module",
@@ -23,11 +23,11 @@
"@actions/core": "^3.0.1",
"@actions/exec": "^3.0.0",
"@actions/github": "^9.1.1",
"@changesets/get-release-plan": "^5.0.0-next.7",
"@changesets/get-release-plan": "^5.0.0-next.11",
"@changesets/ghcommit": "^3.0.0",
"@changesets/git": "^4.0.0-next.6",
"@changesets/pre": "^3.0.0-next.6",
"@changesets/read": "^1.0.0-next.7",
"@changesets/git": "^4.0.0-next.9",
"@changesets/pre": "^3.0.0-next.9",
"@changesets/read": "^1.0.0-next.10",
"@manypkg/get-packages": "^3.1.0",
"@octokit/core": "^7.0.6",
"@octokit/plugin-throttling": "^11.0.3",
@@ -37,10 +37,10 @@
"tinyexec": "^1.2.4"
},
"devDependencies": {
"@changesets/changelog-github": "^1.0.0-next.6",
"@changesets/cli": "^3.0.0-next.8",
"@changesets/types": "^7.0.0-next.6",
"@changesets/write": "^1.0.0-next.6",
"@changesets/changelog-github": "^1.0.0-next.9",
"@changesets/cli": "^3.0.0-next.12",
"@changesets/types": "^7.0.0-next.9",
"@changesets/write": "^1.0.0-next.9",
"@tsconfig/node24": "^24.0.4",
"@types/node": "^24.12.4",
"@types/semver": "^7.7.1",
+135 -127
View File
@@ -26,20 +26,20 @@ importers:
specifier: ^9.1.1
version: 9.1.1
'@changesets/get-release-plan':
specifier: ^5.0.0-next.7
version: 5.0.0-next.7
specifier: ^5.0.0-next.11
version: 5.0.0-next.11
'@changesets/ghcommit':
specifier: ^3.0.0
version: 3.0.0
'@changesets/git':
specifier: ^4.0.0-next.6
version: 4.0.0-next.6
specifier: ^4.0.0-next.9
version: 4.0.0-next.9
'@changesets/pre':
specifier: ^3.0.0-next.6
version: 3.0.0-next.6
specifier: ^3.0.0-next.9
version: 3.0.0-next.9
'@changesets/read':
specifier: ^1.0.0-next.7
version: 1.0.0-next.7
specifier: ^1.0.0-next.10
version: 1.0.0-next.10
'@manypkg/get-packages':
specifier: ^3.1.0
version: 3.1.0
@@ -63,17 +63,17 @@ importers:
version: 1.2.4
devDependencies:
'@changesets/changelog-github':
specifier: ^1.0.0-next.6
version: 1.0.0-next.6
specifier: ^1.0.0-next.9
version: 1.0.0-next.9
'@changesets/cli':
specifier: ^3.0.0-next.8
version: 3.0.0-next.8
specifier: ^3.0.0-next.12
version: 3.0.0-next.12
'@changesets/types':
specifier: ^7.0.0-next.6
version: 7.0.0-next.6
specifier: ^7.0.0-next.9
version: 7.0.0-next.9
'@changesets/write':
specifier: ^1.0.0-next.6
version: 1.0.0-next.6
specifier: ^1.0.0-next.9
version: 1.0.0-next.9
'@tsconfig/node24':
specifier: ^24.0.4
version: 24.0.4
@@ -186,89 +186,89 @@ packages:
'@bufbuild/protoplugin@2.12.0':
resolution: {integrity: sha512-ORlDITp8AFUXzIhLRoMCG+ud+D3MPKWb5HQXBoskMMnjeyEjE1H1qLonVNPyOr8lkx3xSfYUo8a0dvOZJVAzow==}
'@changesets/apply-release-plan@8.0.0-next.7':
resolution: {integrity: sha512-gHXYyBf0+jri/wjA8TYrcyo7HEnN9QAFpU9+1ZWiDMjov7x3cG72r4NQC0T0hTUW+I1bayMFm95EGOvNtLxTSg==}
'@changesets/apply-release-plan@8.0.0-next.11':
resolution: {integrity: sha512-PEBXU4RT4TDjqZLlQ8dKAptC/rhRTQHCb35cqNdkZNMUzEngW1HnW9e90RnBuC5I9n9BK6T0aeOVU/Z4Ep9Hdg==}
engines: {node: ^22.11 || ^24 || >=26}
'@changesets/assemble-release-plan@7.0.0-next.7':
resolution: {integrity: sha512-rUYmk2z5665bkLU+/gReGTdmqSYyFmo7ZgWvpc7ny3OXuEvWdOBz+1egvBXwAG4nYaRq8yIG9aKWIG0Dc18gIg==}
'@changesets/assemble-release-plan@7.0.0-next.11':
resolution: {integrity: sha512-Ziwfmz4mRybA3nuXgXXRXSsYZJn+gXt2zp46hKEwlfTOXik/O/D4Ex0U9h6HWhm2t4hgsqt5O0StYjhop3P9Fg==}
engines: {node: ^22.11 || ^24 || >=26}
'@changesets/changelog-git@1.0.0-next.6':
resolution: {integrity: sha512-z+uAi+BhOUJSBlQj2o5n3oFwhCkHQBk+P1JrFFRvA5fv6pDRAZpugQYbXR7dIQZ5Dn4ndG9cidIKb2o/lGs2wQ==}
'@changesets/changelog-git@1.0.0-next.9':
resolution: {integrity: sha512-v9YatKMVoljRPRPzI9PoxDHxBsLXZs+ndKBts6nOJlRpGHoGyzScOyC2YYce0krYhFxhn+lOiIto/7AOlTFuwA==}
engines: {node: ^22.11 || ^24 || >=26}
'@changesets/changelog-github@1.0.0-next.6':
resolution: {integrity: sha512-0ShCWgNt50xP0mryAYT8wtSkMUinG8uhxXgCgwHZ4UvJnR2f4ns8OsGAxYu8FIds7kHFdLOz7qX4YQ6AX4tVUA==}
'@changesets/changelog-github@1.0.0-next.9':
resolution: {integrity: sha512-xGtpDLiJeQdyoOGNfKIKp09+o41J7KTNJ+QXWq8OqrzFbOCuI+KZC1AlyIDAsjZce3tBYLhu9sQtAMkmRnGOew==}
engines: {node: ^22.11 || ^24 || >=26}
'@changesets/cli@3.0.0-next.8':
resolution: {integrity: sha512-gfIPhBs1XNdgXhTJ+uhzfG8jHmMLnQNNL4Uwqxoniw/xmmVRbc9xGIeLniRsGY77RgdhWW0V1z1zVjTztgMQzQ==}
'@changesets/cli@3.0.0-next.12':
resolution: {integrity: sha512-/KqQB/YyZn6c01PpUkCrFjNUwMuCkMBOJfRiY6R66G88u2YJWYDr9iLP0y/imukkm7axvUPNRDvfdGXMArytfQ==}
engines: {node: ^22.11 || ^24 || >=26, npm: '>=10.9.0', pnpm: '>=10.0.0', yarn: '>=4.5.2'}
hasBin: true
'@changesets/config@4.0.0-next.6':
resolution: {integrity: sha512-RTaumXzBthBvXE5axcAdCbSlUQ3l8l8FD1nNQpVXLCK/4Mg+/96BmNhX5Y/Yf80XE7eG+Mfl797Au5HHqPB/2A==}
'@changesets/config@4.0.0-next.10':
resolution: {integrity: sha512-+4fnpbGlL3igY8Q4H8JXNz/c0rl9bX7VC/3skkzZoXDPENVAbDtlIqYo4jhh7uZVttiicp37Uos0YBEOfCZFcw==}
engines: {node: ^22.11 || ^24 || >=26}
'@changesets/errors@1.0.0-next.3':
resolution: {integrity: sha512-p0JrarlyfkpnIK9L1Y8JKoF78IgKEzRPVbG/13gToDpvfV1cWqOVuoDLVCTQjYTwmaHusOmrnuQUlsO88AvP4Q==}
'@changesets/errors@1.0.0-next.4':
resolution: {integrity: sha512-ZUoabMz+a4t0/Eoz5uUHzufcWfXIlkpCuCUWUMkWErqcCjgB0pwuPWSU2CamhufsG7ZKDUlUoIGVSQWyPc77CA==}
engines: {node: ^22.11 || ^24 || >=26}
'@changesets/format@0.1.0':
resolution: {integrity: sha512-m3ScsTpVqQJu6WOV36vpGozJPBu5JWaFXAhG1/yRnzbOnyqomuPrIfm+LeE0PmX4HWPs9Fh4MDH4aDISEsjZaA==}
'@changesets/format@0.1.1':
resolution: {integrity: sha512-OBN/xfe+lcNWCv8P4Ogop9EOTi5QRKd1c2JJfZRBT9AT3AybzDYDfHeX4Y7j20Q4e16BPu3XvcdOe9sPZmTEig==}
engines: {node: ^22.11 || ^24 || >=26}
'@changesets/get-dependents-graph@3.0.0-next.6':
resolution: {integrity: sha512-UhQpHeyygd6uhoBZKLpwYNVqqxp6/QChwh9Phbo9BE3pTxu5e2X2JWZhNtlxkxUdWAGEq0sYExmhjDyYhBD1Xw==}
'@changesets/get-dependents-graph@3.0.0-next.9':
resolution: {integrity: sha512-zyukhblBz0TO7Ze4rJHS/LN8dLvNpKPGEm3YhYRpZnlRCT+r4X9YtrHJjUFHbnjn2wNRRzzy6eHzsFn43YI3jQ==}
engines: {node: ^22.11 || ^24 || >=26}
'@changesets/get-github-info@1.0.0-next.3':
resolution: {integrity: sha512-HQXw3Kcz1hAdCQgGH4cWlKpJWcTeL8pWNJP4zDOR3igoHJQO31wzHhG29XPhxnDBK9wEdyI71Ft86KpXDOLv/Q==}
'@changesets/get-github-info@1.0.0-next.4':
resolution: {integrity: sha512-Bosh+XOoFvLMzAj301tg6phbrEggBtvEccrnceEvYsKSM7PjcIa32Fy22SU5g+501HZywkdwcAlybdWF+e/zzw==}
engines: {node: ^22.11 || ^24 || >=26}
'@changesets/get-release-plan@5.0.0-next.7':
resolution: {integrity: sha512-ek+tXy+SHshWQD5V4uL6pciazjhm/Yt+KxIQEW0W6vIyyjWvFBY6t0xfsv/hCc/+u11riHcoWGwHkGYqC869EQ==}
'@changesets/get-release-plan@5.0.0-next.11':
resolution: {integrity: sha512-2MlhIU7Rjw0pCw2SZc3a9Qxw9SaA2hwUQ7m0bohbFqgy0gw1EA9YW5rUbxUntFP5gIBfcjKmtU7701hULN8GMQ==}
engines: {node: ^22.11 || ^24 || >=26}
'@changesets/ghcommit@3.0.0':
resolution: {integrity: sha512-od3Y0BhzH+zg8ysSiXFiwj1g85g98mt/WDoGdl2EIjRY8TXxsr8JuaRvHafB2kNGqm9qONBQbPX9UOa4uet+6Q==}
engines: {node: ^22.11 || ^24 || >=26}
'@changesets/git@4.0.0-next.6':
resolution: {integrity: sha512-dNFHMQ4uER7Mo49iPKPee4ITUrCaJs6wya+ZfPo2kNzhMmbyv8WE9QuEf8BITBW+lJo5uos8gqUVnjJoerzjbA==}
'@changesets/git@4.0.0-next.9':
resolution: {integrity: sha512-7WqrwEVpsKZKbBGR7hPRuHTbkIMiDdoyxSsQDOWrmuBh13wDTGaIV6yYQoOs0I3l56khxydm/68v01c/+4g9jQ==}
engines: {node: ^22.11 || ^24 || >=26}
'@changesets/parse@1.0.0-next.7':
resolution: {integrity: sha512-6xtwi4SUYbSVTtsnlNdGnXQPQfdwaqV6PVnDcpV+PtQRM4RhfE4gAwrBe9Cth9+4iHyFbvzm+Gusc00XSNF/IQ==}
'@changesets/parse@1.0.0-next.10':
resolution: {integrity: sha512-ENFmw8Ytq6fNY3O+uC99KDdChZ3dM8PFgth3qi1Ms78GCCHsSgik0ojQwGht5VPsP6WhfTkNqW3fCakFt+euHg==}
engines: {node: ^22.11 || ^24 || >=26}
'@changesets/pre@3.0.0-next.6':
resolution: {integrity: sha512-XVZ4JE4UE1bO1JtxxoBkoueHlzWNe227IpfJGlpiD7ZTfdidlRh+4tHxf452IcGMA3rEe3hWPhFE0tdL3uU2lA==}
'@changesets/pre@3.0.0-next.9':
resolution: {integrity: sha512-NznGjw/PCDy6d74DusPriYbLZQl6O8cvRwuv/qsSKUTF/9O9+EvJnXTx+wtHS9SLJnJqRaGprQ1EMSkjRRyDGQ==}
engines: {node: ^22.11 || ^24 || >=26}
'@changesets/read@1.0.0-next.7':
resolution: {integrity: sha512-eoy5Yf9WDN7opiQyNWZCCpeDeYf5mX/qT/MUktDnk2jBmwRUHLvIkTNK+IsR612etTcfO5kLlRNVcBv4smk87A==}
'@changesets/read@1.0.0-next.10':
resolution: {integrity: sha512-wmhNbv8gnN6Gv6dpFftmqkyy5OTQfFWFlyfwLa7s+b0vMihA5ZYwU/Zd8VN53AsSlYp6k8s4sc43ZJk0zUIkRA==}
engines: {node: ^22.11 || ^24 || >=26}
'@changesets/should-skip-package@1.0.0-next.6':
resolution: {integrity: sha512-2y4+DMh7gMMEQaGwKwJMY7cixmJrK7u7rSZQ9t5O+xwqty9qXhO9EKbIeMDlt13A1Bdxuiu7ptkMKC+AoOO28Q==}
'@changesets/should-skip-package@1.0.0-next.9':
resolution: {integrity: sha512-KaDRCnNy+J4Q8vTZIyKGV3wtDyW79bJN7+XBg919ZKneAj7jJpJLIPkVK+MlyGqyWoxhWEcDBRZ3aTjVkx/tnw==}
engines: {node: ^22.11 || ^24 || >=26}
'@changesets/types@7.0.0-next.6':
resolution: {integrity: sha512-bdxuVLYKrCt14kNFb+ltta8pOPFmQWB0DpMcz9IWMD+DRupQ4+wZyCkXIkfIoqu3iN0fcQkSuoZ2tNOfV+fepg==}
'@changesets/types@7.0.0-next.9':
resolution: {integrity: sha512-okzQIKr+HZXZne37+QI0o0GrKNNTinP8jqsSdr2jUXEt8qhiwdG/X2o7aukp4WBtG4R395BOGyJVfaCy+xg7IA==}
engines: {node: ^22.11 || ^24 || >=26}
'@changesets/write@1.0.0-next.6':
resolution: {integrity: sha512-GhtCqRxadKGe2wkMxpX0PqeWgn3vBr7JELJRakKv7zit8EX+La9/a9dosaP98vWisOCyDm1kuO8bUAq2ljRyVw==}
'@changesets/write@1.0.0-next.9':
resolution: {integrity: sha512-vZ7iTrI8FhJydoWla4G9LSk1kJf4yOtA9m3h9Wffvn+0v5DXUe3LrP/7ZBxHlFCu+WY5ypKo+ClLaDvB9I7Zpg==}
engines: {node: ^22.11 || ^24 || >=26}
'@clack/core@1.4.1':
resolution: {integrity: sha512-FILJa1gGKEFTGZAJE9RpVhrjKz3c3h4ar60dSv6cGuDqufQ84YEIS3GAGvZiN+H6yaLbbvTFNejjCC4tXpZEuw==}
'@clack/core@1.4.3':
resolution: {integrity: sha512-/kr3UWNtdJfxZtPgDqUOmG2pvwlmcLGheex5yiZKdwbzZJxhV+HMNR9QNmyY5cGwTNV6LrR7Jtp+KjhUAP1qBQ==}
engines: {node: '>= 20.12.0'}
'@clack/prompts@1.5.1':
resolution: {integrity: sha512-zccHj2z2oCCO4yrDiRSlFOxWerGqRiysP7a5jPK6uoI9URKAquwY42Dd/iUP8JWHxEzdRe4TlbvZCo8z1/mhrw==}
'@clack/prompts@1.7.0':
resolution: {integrity: sha512-y7/yvZ2TPAnR9+jnc00klvNNLkJiXFFrQA/hlLCcxA9a2A4zQIOimyFQ9XfwYKiGD1fb5GY8vbKIIgO8d5Tb2A==}
engines: {node: '>= 20.12.0'}
'@emnapi/core@1.10.0':
@@ -497,8 +497,8 @@ packages:
resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==}
engines: {node: '>=14'}
'@pnpm/deps.graph-sequencer@1100.0.0':
resolution: {integrity: sha512-IfhLdXMjNaAt2Z/r0hAqMvH4UN/Eb6LAbnSHqF9Ay1EhQId8rFX58yIWXLUit6VjJTJAptnSPtO8nSu2/ggQsg==}
'@pnpm/deps.graph-sequencer@1100.0.1':
resolution: {integrity: sha512-pOr5+q1fLYKwFN3LAJuGZEnfXDcQ73zqgDHMtGy+K+uIoUqyY+6MeDCWFwfu+4EFuq76I5EPFofoNAI+Bmmq4A==}
engines: {node: '>=22.13'}
'@protobuf-ts/plugin@2.11.1':
@@ -1172,6 +1172,10 @@ packages:
resolution: {integrity: sha512-SHf/r48b7vOrjve9PxJo3MN5v5yuyjHvdUcrQffT3WXMUfnGmHDVbC4k3sHJaJTgZCwpUplIaAo5ANtMyp3YHg==}
engines: {node: '>=18'}
tinyexec@1.3.0:
resolution: {integrity: sha512-QKAl9m8gWWGHV8jZcPeym6j+XULi6tOf1mT83WYJ4Lk2ytW/uwAWkrP0uFsdoYMdueVJ0qs26wZ+23xeB4ibNQ==}
engines: {node: '>=18'}
tinyglobby@0.2.17:
resolution: {integrity: sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==}
engines: {node: '>=12.0.0'}
@@ -1518,138 +1522,140 @@ snapshots:
transitivePeerDependencies:
- supports-color
'@changesets/apply-release-plan@8.0.0-next.7':
'@changesets/apply-release-plan@8.0.0-next.11':
dependencies:
'@changesets/config': 4.0.0-next.6
'@changesets/format': 0.1.0
'@changesets/git': 4.0.0-next.6
'@changesets/should-skip-package': 1.0.0-next.6
'@changesets/types': 7.0.0-next.6
'@changesets/config': 4.0.0-next.10
'@changesets/format': 0.1.1
'@changesets/git': 4.0.0-next.9
'@changesets/should-skip-package': 1.0.0-next.9
'@changesets/types': 7.0.0-next.9
import-meta-resolve: 4.2.0
jsonc-parser: 3.3.1
semver: 7.8.1
'@changesets/assemble-release-plan@7.0.0-next.7':
'@changesets/assemble-release-plan@7.0.0-next.11':
dependencies:
'@changesets/errors': 1.0.0-next.3
'@changesets/get-dependents-graph': 3.0.0-next.6
'@changesets/should-skip-package': 1.0.0-next.6
'@changesets/types': 7.0.0-next.6
'@changesets/errors': 1.0.0-next.4
'@changesets/get-dependents-graph': 3.0.0-next.9
'@changesets/should-skip-package': 1.0.0-next.9
'@changesets/types': 7.0.0-next.9
semver: 7.8.1
'@changesets/changelog-git@1.0.0-next.6':
'@changesets/changelog-git@1.0.0-next.9':
dependencies:
'@changesets/types': 7.0.0-next.6
'@changesets/types': 7.0.0-next.9
'@changesets/changelog-github@1.0.0-next.6':
'@changesets/changelog-github@1.0.0-next.9':
dependencies:
'@changesets/get-github-info': 1.0.0-next.3
'@changesets/types': 7.0.0-next.6
'@changesets/get-github-info': 1.0.0-next.4
'@changesets/types': 7.0.0-next.9
'@changesets/cli@3.0.0-next.8':
'@changesets/cli@3.0.0-next.12':
dependencies:
'@changesets/apply-release-plan': 8.0.0-next.7
'@changesets/assemble-release-plan': 7.0.0-next.7
'@changesets/changelog-git': 1.0.0-next.6
'@changesets/config': 4.0.0-next.6
'@changesets/errors': 1.0.0-next.3
'@changesets/get-dependents-graph': 3.0.0-next.6
'@changesets/git': 4.0.0-next.6
'@changesets/pre': 3.0.0-next.6
'@changesets/read': 1.0.0-next.7
'@changesets/should-skip-package': 1.0.0-next.6
'@changesets/types': 7.0.0-next.6
'@changesets/write': 1.0.0-next.6
'@clack/prompts': 1.5.1
'@changesets/apply-release-plan': 8.0.0-next.11
'@changesets/assemble-release-plan': 7.0.0-next.11
'@changesets/changelog-git': 1.0.0-next.9
'@changesets/config': 4.0.0-next.10
'@changesets/errors': 1.0.0-next.4
'@changesets/get-dependents-graph': 3.0.0-next.9
'@changesets/git': 4.0.0-next.9
'@changesets/pre': 3.0.0-next.9
'@changesets/read': 1.0.0-next.10
'@changesets/should-skip-package': 1.0.0-next.9
'@changesets/types': 7.0.0-next.9
'@changesets/write': 1.0.0-next.9
'@clack/prompts': 1.7.0
'@manypkg/get-packages': 3.1.0
'@pnpm/deps.graph-sequencer': 1100.0.0
'@pnpm/deps.graph-sequencer': 1100.0.1
cac: 7.0.0
import-meta-resolve: 4.2.0
launch-editor: 2.14.1
package-manager-detector: 1.6.0
semver: 7.8.1
tinyexec: 1.2.4
tinyexec: 1.3.0
'@changesets/config@4.0.0-next.6':
'@changesets/config@4.0.0-next.10':
dependencies:
'@changesets/get-dependents-graph': 3.0.0-next.6
'@changesets/should-skip-package': 1.0.0-next.6
'@changesets/types': 7.0.0-next.6
'@changesets/get-dependents-graph': 3.0.0-next.9
'@changesets/should-skip-package': 1.0.0-next.9
'@changesets/types': 7.0.0-next.9
'@manypkg/get-packages': 3.1.0
picomatch: 4.0.4
'@changesets/errors@1.0.0-next.3': {}
'@changesets/errors@1.0.0-next.4': {}
'@changesets/format@0.1.0':
'@changesets/format@0.1.1':
dependencies:
package-manager-detector: 1.6.0
tinyexec: 1.2.4
'@changesets/get-dependents-graph@3.0.0-next.6':
'@changesets/get-dependents-graph@3.0.0-next.9':
dependencies:
'@changesets/types': 7.0.0-next.6
'@changesets/types': 7.0.0-next.9
semver: 7.8.1
'@changesets/get-github-info@1.0.0-next.3':
'@changesets/get-github-info@1.0.0-next.4':
dependencies:
dataloader: 2.2.3
'@changesets/get-release-plan@5.0.0-next.7':
'@changesets/get-release-plan@5.0.0-next.11':
dependencies:
'@changesets/assemble-release-plan': 7.0.0-next.7
'@changesets/config': 4.0.0-next.6
'@changesets/pre': 3.0.0-next.6
'@changesets/read': 1.0.0-next.7
'@changesets/types': 7.0.0-next.6
'@changesets/assemble-release-plan': 7.0.0-next.11
'@changesets/config': 4.0.0-next.10
'@changesets/pre': 3.0.0-next.9
'@changesets/read': 1.0.0-next.10
'@changesets/types': 7.0.0-next.9
'@manypkg/get-packages': 3.1.0
'@changesets/ghcommit@3.0.0':
dependencies:
tinyexec: 1.2.4
'@changesets/git@4.0.0-next.6':
'@changesets/git@4.0.0-next.9':
dependencies:
'@changesets/errors': 1.0.0-next.3
'@changesets/types': 7.0.0-next.6
'@changesets/errors': 1.0.0-next.4
'@changesets/types': 7.0.0-next.9
'@manypkg/get-packages': 3.1.0
picomatch: 4.0.4
tinyexec: 1.2.4
'@changesets/parse@1.0.0-next.7':
'@changesets/parse@1.0.0-next.10':
dependencies:
'@changesets/types': 7.0.0-next.6
'@changesets/types': 7.0.0-next.9
yaml: 2.9.0
'@changesets/pre@3.0.0-next.6':
'@changesets/pre@3.0.0-next.9':
dependencies:
'@changesets/errors': 1.0.0-next.3
'@changesets/types': 7.0.0-next.6
'@changesets/errors': 1.0.0-next.4
'@changesets/types': 7.0.0-next.9
'@manypkg/get-packages': 3.1.0
'@changesets/read@1.0.0-next.7':
'@changesets/read@1.0.0-next.10':
dependencies:
'@changesets/git': 4.0.0-next.6
'@changesets/parse': 1.0.0-next.7
'@changesets/types': 7.0.0-next.6
'@changesets/git': 4.0.0-next.9
'@changesets/parse': 1.0.0-next.10
'@changesets/types': 7.0.0-next.9
'@changesets/should-skip-package@1.0.0-next.6':
'@changesets/should-skip-package@1.0.0-next.9':
dependencies:
'@changesets/types': 7.0.0-next.6
'@changesets/types': 7.0.0-next.9
'@changesets/types@7.0.0-next.6': {}
'@changesets/types@7.0.0-next.9': {}
'@changesets/write@1.0.0-next.6':
'@changesets/write@1.0.0-next.9':
dependencies:
'@changesets/format': 0.1.0
'@changesets/types': 7.0.0-next.6
'@changesets/format': 0.1.1
'@changesets/types': 7.0.0-next.9
human-id: 4.2.0
'@clack/core@1.4.1':
'@clack/core@1.4.3':
dependencies:
fast-wrap-ansi: 0.2.2
sisteransi: 1.0.5
'@clack/prompts@1.5.1':
'@clack/prompts@1.7.0':
dependencies:
'@clack/core': 1.4.1
'@clack/core': 1.4.3
fast-string-width: 3.0.2
fast-wrap-ansi: 0.2.2
sisteransi: 1.0.5
@@ -1837,7 +1843,7 @@ snapshots:
'@pkgjs/parseargs@0.11.0':
optional: true
'@pnpm/deps.graph-sequencer@1100.0.0': {}
'@pnpm/deps.graph-sequencer@1100.0.1': {}
'@protobuf-ts/plugin@2.11.1':
dependencies:
@@ -2484,6 +2490,8 @@ snapshots:
tinyexec@1.2.4: {}
tinyexec@1.3.0: {}
tinyglobby@0.2.17:
dependencies:
fdir: 6.5.0(picomatch@4.0.4)
+16 -16
View File
@@ -3,22 +3,22 @@ dedupePeers: true
dedupePeerDependents: true
minimumReleaseAge: 10080
minimumReleaseAgeExclude:
- "@changesets/apply-release-plan@8.0.0-next.7"
- "@changesets/assemble-release-plan@7.0.0-next.7"
- "@changesets/changelog-git@1.0.0-next.6"
- "@changesets/changelog-github@1.0.0-next.6"
- "@changesets/cli@3.0.0-next.8"
- "@changesets/config@4.0.0-next.6"
- "@changesets/get-dependents-graph@3.0.0-next.6"
- "@changesets/get-github-info@1.0.0-next.3"
- "@changesets/get-release-plan@5.0.0-next.7"
- "@changesets/git@4.0.0-next.6"
- "@changesets/parse@1.0.0-next.7"
- "@changesets/pre@3.0.0-next.6"
- "@changesets/read@1.0.0-next.7"
- "@changesets/should-skip-package@1.0.0-next.6"
- "@changesets/types@7.0.0-next.6"
- "@changesets/write@1.0.0-next.6"
- "@changesets/apply-release-plan@8.0.0-next.11"
- "@changesets/assemble-release-plan@7.0.0-next.11"
- "@changesets/changelog-git@1.0.0-next.9"
- "@changesets/changelog-github@1.0.0-next.9"
- "@changesets/cli@3.0.0-next.12"
- "@changesets/config@4.0.0-next.10"
- "@changesets/get-dependents-graph@3.0.0-next.9"
- "@changesets/get-github-info@1.0.0-next.4"
- "@changesets/get-release-plan@5.0.0-next.11"
- "@changesets/git@4.0.0-next.9"
- "@changesets/parse@1.0.0-next.10"
- "@changesets/pre@3.0.0-next.9"
- "@changesets/read@1.0.0-next.10"
- "@changesets/should-skip-package@1.0.0-next.9"
- "@changesets/types@7.0.0-next.9"
- "@changesets/write@1.0.0-next.9"
overrides:
lightningcss: "-" # we do not bundle any css
+22 -35
View File
@@ -1,15 +1,11 @@
import { Buffer } from "node:buffer";
import path from "node:path";
import { exec, getExecOutput } from "@actions/exec";
import major from "semver/functions/major.js";
import prerelease from "semver/functions/prerelease.js";
import { exec } from "@actions/exec";
import pkgJson from "../package.json" with { type: "json" };
const tag = `v${pkgJson.version}`;
const prereleaseTag = prerelease(pkgJson.version)?.[0];
const releaseLine = `v${major(pkgJson.version)}${
prereleaseTag === undefined ? "" : `-${prereleaseTag}`
}`;
const releaseLine = `v${pkgJson.version.split(".")[0]}`;
const isPrerelease = pkgJson.version.includes("-");
const githubToken = process.env.GITHUB_TOKEN;
if (!githubToken) {
throw new Error("GITHUB_TOKEN is required");
@@ -25,36 +21,27 @@ const gitEnv = {
process.chdir(path.join(import.meta.dirname, ".."));
await exec("git", ["checkout", "--detach"]);
// Stable timestamps make retries produce the same commit when dist is unchanged.
const { stdout } = await getExecOutput("git", [
"show",
"--no-patch",
"--format=%cI",
"HEAD",
]);
const commitDate = stdout.trim();
await exec("git", ["add", "--force", "dist"]);
await exec("git", ["commit", "-m", tag], {
env: {
...process.env,
GIT_AUTHOR_DATE: commitDate,
GIT_COMMITTER_DATE: commitDate,
},
});
await exec("git", ["commit", "-m", tag]);
await exec("changeset", ["git-tag"]);
await exec(
"git",
[
"push",
"--force",
// The action pushes tags through the API; override any push.followTags config.
"--no-follow-tags",
"origin",
`HEAD:refs/heads/${releaseLine}`,
],
{
if (isPrerelease) {
await exec("git", ["push", "origin", `refs/tags/${tag}`], {
env: gitEnv,
},
);
});
} else {
await exec(
"git",
[
"push",
"--force",
"--follow-tags",
"origin",
`HEAD:refs/heads/${releaseLine}`,
],
{
env: gitEnv,
},
);
}
+8 -61
View File
@@ -1,4 +1,3 @@
import assert from "node:assert/strict";
import { Buffer } from "node:buffer";
import * as core from "@actions/core";
import { exec, getExecOutput } from "@actions/exec";
@@ -68,19 +67,6 @@ function getHttpUrl(remoteUrl: string): string | undefined {
}
}
function isAlreadyExistingRefError(error: unknown) {
return (
typeof error === "object" &&
error !== null &&
"status" in error &&
"message" in error &&
typeof error.status === "number" &&
typeof error.message === "string" &&
error.status === 422 &&
error.message.includes("Reference already exists")
);
}
export class GitHub {
readonly #githubToken: string;
readonly octokit: Octokit;
@@ -226,57 +212,18 @@ export class GitHub {
);
}
async #getRemoteTagCommit(tag: string) {
const { data: ref } = await this.octokit.rest.git.getRef({
...context.repo,
ref: `tags/${tag}`,
});
let target: { type: string; sha: string } = ref.object;
while (target.type === "tag") {
const { data: tagObject } = await this.octokit.rest.git.getTag({
...context.repo,
tag_sha: target.sha,
});
target = tagObject.object;
}
assert.equal(
target.type,
"commit",
`Tag ${tag} points to a ${target.type}, not a commit`,
);
return target.sha;
}
async pushTag(tag: string, commit = context.sha) {
async pushTag(tag: string) {
if (!this.pushWithGitCli) {
try {
const { data: tagObject } = await this.octokit.rest.git.createTag({
...context.repo,
tag,
message: tag,
object: commit,
type: "commit",
});
await this.octokit.rest.git.createRef({
return this.octokit.rest.git
.createRef({
...context.repo,
ref: `refs/tags/${tag}`,
sha: tagObject.sha,
sha: context.sha,
})
.catch((err) => {
// Assuming tag was manually pushed in custom publish script
core.warning(`Failed to create tag ${tag}: ${err.message}`);
});
} catch (err) {
if (isAlreadyExistingRefError(err)) {
const remoteCommit = await this.#getRemoteTagCommit(tag);
assert.equal(
remoteCommit,
commit,
`Tag ${tag} points to commit ${remoteCommit}, expected ${commit}`,
);
// The tag was likely pushed by a custom publish script.
core.info(`Tag ${tag} already exists`);
return;
}
throw err;
}
return;
}
await exec("git", ["push", "origin", tag], {
cwd: this.cwd,
+40
View File
@@ -0,0 +1,40 @@
import { createFixture } from "fs-fixture";
import { describe, expect, it } from "vitest";
import readChangesetState from "./readChangesetState.ts";
const changeset = `---
"pkg-a": patch
---
Fix a bug.
`;
describe("readChangesetState", () => {
it("filters versioned changesets in prerelease mode", async () => {
await using fixture = await createFixture({
".changeset/pre.json": JSON.stringify({ mode: "pre", tag: "next" }),
".changeset/pre/versioned.md": changeset,
".changeset/pending.md": changeset,
});
const state = await readChangesetState(fixture.path);
expect(state.changesets.map((changeset) => changeset.id)).toEqual([
"pending",
]);
});
it("includes versioned changesets when exiting prerelease mode", async () => {
await using fixture = await createFixture({
".changeset/pre.json": JSON.stringify({ mode: "exit", tag: "next" }),
".changeset/pre/versioned.md": changeset,
});
const state = await readChangesetState(fixture.path);
expect(state.preState).toBeUndefined();
expect(state.changesets.map((changeset) => changeset.id)).toEqual([
"pre/versioned",
]);
});
});
+3 -3
View File
@@ -14,11 +14,11 @@ export default async function readChangesetState(
let changesets = await readChangesets(cwd);
if (preState !== undefined && preState.mode === "pre") {
let changesetsToFilter = new Set(preState.changesets);
return {
preState,
changesets: changesets.filter((x) => !changesetsToFilter.has(x.id)),
changesets: changesets.filter(
(changeset) => !changeset.id.startsWith("pre/"),
),
};
}
+3 -55
View File
@@ -1,5 +1,3 @@
import assert from "node:assert/strict";
import { Buffer } from "node:buffer";
import { randomUUID } from "node:crypto";
import fs from "node:fs/promises";
import os from "node:os";
@@ -157,45 +155,6 @@ async function readChangesetsOutput(outputPath: string) {
return events;
}
type Release = {
pkg: Package;
tag: string;
commit?: string;
};
async function getTagCommits(cwd: string, tags: string[]) {
if (tags.length === 0) {
return [];
}
const refs = tags.map((tag) => `refs/tags/${tag}^{}`);
const { stdout } = await getExecOutput(
"git",
["cat-file", "--batch-check=%(objectname) %(objecttype)"],
{
cwd,
input: Buffer.from(`${refs.join("\n")}\n`),
},
);
const lines = stdout.trim().split(/\r?\n/);
assert.equal(
lines.length,
tags.length,
"Git returned an unexpected number of tag targets",
);
return lines.map((line, index) => {
if (line === `${refs[index]} missing`) {
return undefined;
}
const [commit, type] = line.split(" ");
assert.equal(
type,
"commit",
`Tag ${tags[index]} does not point to a commit`,
);
return commit;
});
}
export async function runPublish({
script,
fromPackDir,
@@ -255,7 +214,7 @@ export async function runPublish({
);
output = [];
}
let releases: Release[] = output.map((event) => {
let releases = output.map((event) => {
let pkg = packagesByName.get(event.packageName);
if (pkg === undefined) {
throw new Error(
@@ -273,22 +232,11 @@ export async function runPublish({
);
}
if (pushGitTags) {
const commits = await getTagCommits(
cwd,
releases.map(({ tag }) => tag),
);
releases = releases.map((release, index) => ({
...release,
commit: commits[index],
}));
}
if (createGithubReleases || pushGitTags) {
await Promise.all(
releases.map(async ({ pkg, tag, commit }) => {
releases.map(async ({ pkg, tag }) => {
if (pushGitTags) {
await github.pushTag(tag, commit);
await github.pushTag(tag);
}
if (createGithubReleases) {
await createRelease(octokit, { pkg, tagName: tag });