Use split publishing workflow (#679)

* fix release line timing

* Use split publishing workflow

* remove release check, handle through publish plan

* remove unused script

* remove unused publish plan output

* fmt

* update a thing

* fmt

* simplify

* update pre

* update changesets cli
This commit is contained in:
Mateusz Burzyński
2026-07-01 12:24:41 +00:00
committed by GitHub
parent 73591071e6
commit cf45e93c21
8 changed files with 62 additions and 56 deletions
+7 -6
View File
@@ -1,13 +1,14 @@
{ {
"$schema": "https://unpkg.com/@changesets/config@1.6.2/schema.json", "$schema": "https://unpkg.com/@changesets/config@4.0.0-next.6/schema.json",
"changelog": [ "changelog": "@changesets/changelog-github",
"@changesets/changelog-github",
{ "repo": "changesets/action" }
],
"commit": false, "commit": false,
"linked": [], "linked": [],
"access": "restricted", "access": "restricted",
"baseBranch": "main", "baseBranch": "main",
"updateInternalDependencies": "patch", "updateInternalDependencies": "patch",
"ignore": [] "ignore": [],
"privatePackages": {
"version": true,
"tag": true
}
} }
-3
View File
@@ -1,9 +1,6 @@
{ {
"mode": "pre", "mode": "pre",
"tag": "next", "tag": "next",
"initialVersions": {
"@changesets/action": "1.9.0"
},
"changesets": [ "changesets": [
"all-cars-grin", "all-cars-grin",
"eight-clocks-pull", "eight-clocks-pull",
+33 -8
View File
@@ -15,13 +15,38 @@ concurrency:
permissions: {} # each job should define its own permission explicitly permissions: {} # each job should define its own permission explicitly
jobs: jobs:
select-mode:
name: Select mode
runs-on: ubuntu-latest
timeout-minutes: 20
outputs:
mode: ${{ steps.select-mode.outputs.mode }}
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
with:
skip-cache: true # avoid cache poisoning attacks
- name: Build
run: pnpm build
- name: Select mode
id: select-mode
uses: ./select-mode
version: version:
name: Version name: Version
if: needs.select-mode.outputs.mode == 'version'
needs: select-mode
runs-on: ubuntu-latest runs-on: ubuntu-latest
environment: version environment: version
timeout-minutes: 20 timeout-minutes: 20
outputs:
hasChangesets: ${{ steps.changesets.outputs.hasChangesets }}
permissions: permissions:
contents: read # to check out repo (actions/checkout) contents: read # to check out repo (actions/checkout)
steps: steps:
@@ -47,15 +72,15 @@ jobs:
- name: Create or update release pull request - name: Create or update release pull request
id: changesets id: changesets
uses: ./ uses: ./version
with: with:
github-token: ${{ steps.app-token.outputs.token }} github-token: ${{ steps.app-token.outputs.token }}
version: pnpm bump script: pnpm bump
publish: publish:
name: Publish name: Publish
if: needs.version.outputs.hasChangesets == 'false' if: needs.select-mode.outputs.mode == 'publish'
needs: version needs: select-mode
runs-on: ubuntu-latest runs-on: ubuntu-latest
environment: marketplace environment: marketplace
timeout-minutes: 20 timeout-minutes: 20
@@ -82,7 +107,7 @@ jobs:
run: pnpm build run: pnpm build
- name: Publish to marketplace - name: Publish to marketplace
uses: ./ uses: ./publish
with: with:
github-token: ${{ steps.app-token.outputs.token }} github-token: ${{ steps.app-token.outputs.token }}
publish: pnpm release script: pnpm release
+2 -1
View File
@@ -1,6 +1,7 @@
{ {
"name": "@changesets/action", "name": "@changesets/action",
"version": "2.0.0-next.2", "version": "2.0.0-next.2",
"private": true,
"license": "MIT", "license": "MIT",
"type": "module", "type": "module",
"main": "dist/index.js", "main": "dist/index.js",
@@ -36,7 +37,7 @@
}, },
"devDependencies": { "devDependencies": {
"@changesets/changelog-github": "^1.0.0-next.6", "@changesets/changelog-github": "^1.0.0-next.6",
"@changesets/cli": "^3.0.0-next.7", "@changesets/cli": "^3.0.0-next.8",
"@changesets/types": "^7.0.0-next.6", "@changesets/types": "^7.0.0-next.6",
"@changesets/write": "^1.0.0-next.6", "@changesets/write": "^1.0.0-next.6",
"@tsconfig/node24": "^24.0.4", "@tsconfig/node24": "^24.0.4",
+5 -5
View File
@@ -66,8 +66,8 @@ importers:
specifier: ^1.0.0-next.6 specifier: ^1.0.0-next.6
version: 1.0.0-next.6 version: 1.0.0-next.6
'@changesets/cli': '@changesets/cli':
specifier: ^3.0.0-next.7 specifier: ^3.0.0-next.8
version: 3.0.0-next.7 version: 3.0.0-next.8
'@changesets/types': '@changesets/types':
specifier: ^7.0.0-next.6 specifier: ^7.0.0-next.6
version: 7.0.0-next.6 version: 7.0.0-next.6
@@ -199,8 +199,8 @@ packages:
resolution: {integrity: sha512-0ShCWgNt50xP0mryAYT8wtSkMUinG8uhxXgCgwHZ4UvJnR2f4ns8OsGAxYu8FIds7kHFdLOz7qX4YQ6AX4tVUA==} resolution: {integrity: sha512-0ShCWgNt50xP0mryAYT8wtSkMUinG8uhxXgCgwHZ4UvJnR2f4ns8OsGAxYu8FIds7kHFdLOz7qX4YQ6AX4tVUA==}
engines: {node: ^22.11 || ^24 || >=26} engines: {node: ^22.11 || ^24 || >=26}
'@changesets/cli@3.0.0-next.7': '@changesets/cli@3.0.0-next.8':
resolution: {integrity: sha512-DuwcGhtFina59DCREvS6N97zlXyYqnbhnFO/PBHaX5+ZalYsLxfnbWiwrbosdmy9QBlnvkyqXPVN2TFPZXzJmw==} resolution: {integrity: sha512-gfIPhBs1XNdgXhTJ+uhzfG8jHmMLnQNNL4Uwqxoniw/xmmVRbc9xGIeLniRsGY77RgdhWW0V1z1zVjTztgMQzQ==}
engines: {node: ^22.11 || ^24 || >=26, npm: '>=10.9.0', pnpm: '>=10.0.0', yarn: '>=4.5.2'} engines: {node: ^22.11 || ^24 || >=26, npm: '>=10.9.0', pnpm: '>=10.0.0', yarn: '>=4.5.2'}
hasBin: true hasBin: true
@@ -1543,7 +1543,7 @@ snapshots:
'@changesets/get-github-info': 1.0.0-next.3 '@changesets/get-github-info': 1.0.0-next.3
'@changesets/types': 7.0.0-next.6 '@changesets/types': 7.0.0-next.6
'@changesets/cli@3.0.0-next.7': '@changesets/cli@3.0.0-next.8':
dependencies: dependencies:
'@changesets/apply-release-plan': 8.0.0-next.7 '@changesets/apply-release-plan': 8.0.0-next.7
'@changesets/assemble-release-plan': 7.0.0-next.7 '@changesets/assemble-release-plan': 7.0.0-next.7
+1 -1
View File
@@ -7,7 +7,7 @@ minimumReleaseAgeExclude:
- "@changesets/assemble-release-plan@7.0.0-next.7" - "@changesets/assemble-release-plan@7.0.0-next.7"
- "@changesets/changelog-git@1.0.0-next.6" - "@changesets/changelog-git@1.0.0-next.6"
- "@changesets/changelog-github@1.0.0-next.6" - "@changesets/changelog-github@1.0.0-next.6"
- "@changesets/cli@3.0.0-next.7" - "@changesets/cli@3.0.0-next.8"
- "@changesets/config@4.0.0-next.6" - "@changesets/config@4.0.0-next.6"
- "@changesets/get-dependents-graph@3.0.0-next.6" - "@changesets/get-dependents-graph@3.0.0-next.6"
- "@changesets/get-github-info@1.0.0-next.3" - "@changesets/get-github-info@1.0.0-next.3"
+3 -1
View File
@@ -1,12 +1,14 @@
import fs from "node:fs"; import fs from "node:fs";
import path from "node:path"; import path from "node:path";
import { exec } from "@actions/exec"; import { exec } from "@actions/exec";
import pkgJson from "../package.json" with { type: "json" };
process.chdir(path.join(import.meta.dirname, "..")); process.chdir(path.join(import.meta.dirname, ".."));
await exec("changeset", ["version"]); await exec("changeset", ["version"]);
// read after versioning to get the new version
const pkgJson = (await import("../package.json", { with: { type: "json" } }))
.default;
const releaseLine = `v${pkgJson.version.split(".")[0]}`; const releaseLine = `v${pkgJson.version.split(".")[0]}`;
const readmePath = path.join(import.meta.dirname, "..", "README.md"); const readmePath = path.join(import.meta.dirname, "..", "README.md");
+3 -23
View File
@@ -1,6 +1,6 @@
import { Buffer } from "node:buffer"; import { Buffer } from "node:buffer";
import path from "node:path"; import path from "node:path";
import { exec, getExecOutput } from "@actions/exec"; import { exec } from "@actions/exec";
import pkgJson from "../package.json" with { type: "json" }; import pkgJson from "../package.json" with { type: "json" };
const tag = `v${pkgJson.version}`; const tag = `v${pkgJson.version}`;
@@ -20,24 +20,6 @@ const gitEnv = {
process.chdir(path.join(import.meta.dirname, "..")); process.chdir(path.join(import.meta.dirname, ".."));
(async () => {
const { exitCode, stderr } = await getExecOutput(
`git`,
["ls-remote", "--exit-code", "origin", "--tags", `refs/tags/${tag}`],
{
ignoreReturnCode: true,
},
);
if (exitCode === 0) {
console.log(
`Action is not being published because version ${tag} is already published`,
);
return;
}
if (exitCode !== 2) {
throw new Error(`git ls-remote exited with ${exitCode}:\n${stderr}`);
}
await exec("git", ["checkout", "--detach"]); await exec("git", ["checkout", "--detach"]);
await exec("git", ["add", "--force", "dist"]); await exec("git", ["add", "--force", "dist"]);
await exec("git", ["commit", "-m", tag]); await exec("git", ["commit", "-m", tag]);
@@ -48,9 +30,7 @@ process.chdir(path.join(import.meta.dirname, ".."));
await exec("git", ["push", "origin", `refs/tags/${tag}`], { await exec("git", ["push", "origin", `refs/tags/${tag}`], {
env: gitEnv, env: gitEnv,
}); });
return; } else {
}
await exec( await exec(
"git", "git",
[ [
@@ -64,4 +44,4 @@ process.chdir(path.join(import.meta.dirname, ".."));
env: gitEnv, env: gitEnv,
}, },
); );
})(); }