@ankhorage/devtools 1.11.2 → 1.11.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -338,7 +338,7 @@ A repository participates in Changesets synchronization when `.changeset/config.
338
338
  .github/workflows/release.yml
339
339
  ```
340
340
 
341
- CI and Release render their `bun-version` from the same managed Bun runtime policy used for `package.json`. They also render Changesets status, version, and publish commands from the same policy that owns the synchronized package scripts. The CI workflow installs that Bun version with the frozen lockfile, builds before repository-provider validation, runs `bunx @ankhorage/ankh doctor validate .`, and conditionally runs lint, formatting, Knip, tests, typecheck, and Changesets checks. Ordinary pull requests run the strict `changeset:status --since=origin/main` guard. A same-repository `changeset-release/main` pull request instead runs `bun run changeset -- status --since=HEAD`, validating the Version Packages metadata from the detached release checkout without requiring a local `main` ref or another unreleased Changeset after the release Changeset was consumed. A fork using that branch name remains subject to the ordinary strict guard. Release publishing calls the Devtools-owned runner through the synchronized package script; it never resolves an ambient or mutable Changesets executable. Changesets v3 creates the local release tags; the managed workflow pushes those exact tags and creates any missing GitHub Releases directly, without parsing Changesets’ human-readable publish output.
341
+ CI and Release render their `bun-version` from the same managed Bun runtime policy used for `package.json`. They also render Changesets status, version, and publish commands from the same policy that owns the synchronized package scripts. The CI workflow installs that Bun version with the frozen lockfile, builds before repository-provider validation, runs `bunx @ankhorage/ankh doctor validate .`, and conditionally runs lint, formatting, Knip, tests, typecheck, and the strict `changeset:status --since=origin/main` guard for pull requests. After a green change reaches `main`, Release uses the scoped Ankhorage Renovate Sync App token to apply Changesets versioning directly to `main` in a `chore(release)` `[skip ci]` commit and publishes without creating a second Version Packages pull request. Release publishing calls the Devtools-owned runner through the synchronized package script; it never resolves an ambient or mutable Changesets executable. Changesets v3 creates the local release tags; the managed workflow pushes those exact tags and creates any missing GitHub Releases directly, without parsing Changesets’ human-readable publish output.
342
342
 
343
343
  The Renovate workflow accepts only same-repository branches created by `renovate[bot]`. It calls the SHA-pinned `ankhorage/renovate` workflow to add a release Changeset for runtime Ankhorage dependency updates or an empty Changeset for dev-only updates. The trusted workflow scopes the Ankhorage Renovate Sync GitHub App token to the current repository and uses it only for the validated commit, allowing every normal pull-request CI workflow to start without manual approval. It never checks out or executes pull-request code in the privileged `pull_request_target` context.
344
344
 
@@ -27,8 +27,8 @@ const REQUIRED_README_SNIPPETS = [
27
27
  "profile: 'auto'",
28
28
  '@ankhorage/utility/project',
29
29
  'ankhorage-changeset',
30
- 'changeset-release/main',
31
- 'bun run changeset -- status --since=HEAD',
30
+ 'without creating a second Version Packages pull request',
31
+ 'chore(release)',
32
32
  '.changeset/config.json',
33
33
  '<!-- devtools-bun-policy:start -->',
34
34
  '<!-- devtools-bun-policy:end -->',
@@ -11,12 +11,8 @@ export declare const changesetsPolicy: {
11
11
  readonly 'changeset:status': "bun src/cli/bin/changeset.ts status --since=origin/main";
12
12
  readonly 'version-packages': "bun src/cli/bin/changeset.ts version";
13
13
  };
14
- readonly workflowArguments: {
15
- readonly versionPackagesStatus: readonly ["status", "--since=HEAD"];
16
- };
17
14
  readonly workflowCommands: {
18
15
  readonly status: "bun run changeset:status";
19
- readonly versionPackagesStatus: `bun run changeset -- ${string}`;
20
16
  readonly version: "bun run version-packages";
21
17
  readonly publish: "bun run changeset -- publish";
22
18
  };
@@ -1,4 +1,3 @@
1
- const versionPackagesStatusArguments = ['status', '--since=HEAD'];
2
1
  export const changesetsPolicy = {
3
2
  packageName: '@changesets/cli',
4
3
  binaryName: 'ankhorage-changeset',
@@ -12,12 +11,8 @@ export const changesetsPolicy = {
12
11
  'changeset:status': 'bun src/cli/bin/changeset.ts status --since=origin/main',
13
12
  'version-packages': 'bun src/cli/bin/changeset.ts version',
14
13
  },
15
- workflowArguments: {
16
- versionPackagesStatus: versionPackagesStatusArguments,
17
- },
18
14
  workflowCommands: {
19
15
  status: 'bun run changeset:status',
20
- versionPackagesStatus: `bun run changeset -- ${versionPackagesStatusArguments.join(' ')}`,
21
16
  version: 'bun run version-packages',
22
17
  publish: 'bun run changeset -- publish',
23
18
  },
@@ -84,17 +84,8 @@ jobs:
84
84
  echo "No typecheck script found; skipping."
85
85
  fi
86
86
 
87
- - name: Validate Version Packages metadata
88
- if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.head_ref == 'changeset-release/main'
89
- run: |
90
- if node -e "const p=require('./package.json'); process.exit(p.scripts?.changeset ? 0 : 1)"; then
91
- __ANKH_CHANGESETS_VERSION_PACKAGES_STATUS_COMMAND__
92
- else
93
- echo "No changeset script found; skipping."
94
- fi
95
-
96
87
  - name: Check changesets
97
- if: github.event_name == 'pull_request' && (github.event.pull_request.head.repo.full_name != github.repository || github.head_ref != 'changeset-release/main')
88
+ if: github.event_name == 'pull_request'
98
89
  run: |
99
90
  if node -e "const p=require('./package.json'); process.exit(p.scripts?.['changeset:status'] ? 0 : 1)"; then
100
91
  __ANKH_CHANGESETS_STATUS_COMMAND__
@@ -7,7 +7,6 @@ on:
7
7
 
8
8
  permissions:
9
9
  contents: write
10
- pull-requests: write
11
10
  id-token: write
12
11
 
13
12
  concurrency:
@@ -19,10 +18,21 @@ jobs:
19
18
  runs-on: ubuntu-latest
20
19
 
21
20
  steps:
21
+ - name: Create the scoped release token
22
+ id: release-token
23
+ uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
24
+ with:
25
+ client-id: ${{ vars.ANKHORAGE_RENOVATE_SYNC_CLIENT_ID }}
26
+ private-key: ${{ secrets.ANKHORAGE_RENOVATE_SYNC_PRIVATE_KEY }}
27
+ owner: ankhorage
28
+ repositories: ${{ github.event.repository.name }}
29
+ permission-contents: write
30
+
22
31
  - name: Checkout repository
23
32
  uses: actions/checkout@v4
24
33
  with:
25
34
  fetch-depth: 0
35
+ token: ${{ steps.release-token.outputs.token }}
26
36
 
27
37
  - name: Setup Bun
28
38
  uses: oven-sh/setup-bun@v2
@@ -49,18 +59,36 @@ jobs:
49
59
  echo "No build script found; skipping."
50
60
  fi
51
61
 
52
- - name: Create release pull request or publish to npm
53
- id: changesets
62
+ - name: Version packages directly on main
63
+ id: release
54
64
  if: hashFiles('.changeset/config.json') != ''
55
- uses: changesets/action@v1
56
- with:
57
- version: __ANKH_CHANGESETS_VERSION_COMMAND__
58
- publish: __ANKH_CHANGESETS_PUBLISH_COMMAND__
59
- commit: Version Packages
60
- title: Version Packages
61
- createGithubReleases: false
62
- env:
63
- GITHUB_TOKEN: ${{ github.token }}
65
+ run: |
66
+ before_version="$(node -p "require('./package.json').version")"
67
+ __ANKH_CHANGESETS_VERSION_COMMAND__
68
+ after_version="$(node -p "require('./package.json').version")"
69
+
70
+ if git diff --quiet; then
71
+ echo "versioned=false" >> "$GITHUB_OUTPUT"
72
+ exit 0
73
+ fi
74
+
75
+ git config user.name "ankhorage-renovate-sync[bot]"
76
+ git config user.email "ankhorage-renovate-sync[bot]@users.noreply.github.com"
77
+ git add --all
78
+ git commit -m "chore(release): version packages [skip ci]"
79
+ git push origin HEAD:main
80
+
81
+ if [ "$before_version" = "$after_version" ]; then
82
+ echo "versioned=false" >> "$GITHUB_OUTPUT"
83
+ else
84
+ echo "versioned=true" >> "$GITHUB_OUTPUT"
85
+ echo "package_name=$(node -p "require('./package.json').name")" >> "$GITHUB_OUTPUT"
86
+ echo "package_version=$after_version" >> "$GITHUB_OUTPUT"
87
+ fi
88
+
89
+ - name: Publish unpublished packages
90
+ if: hashFiles('.changeset/config.json') != ''
91
+ run: __ANKH_CHANGESETS_PUBLISH_COMMAND__
64
92
 
65
93
  - name: Finalize Changesets v3 tags and GitHub releases
66
94
  if: hashFiles('.changeset/config.json') != ''
@@ -79,7 +107,7 @@ jobs:
79
107
 
80
108
  - name: Create the scoped rollout token
81
109
  id: rollout-token
82
- if: steps.changesets.outputs.published == 'true'
110
+ if: steps.release.outputs.versioned == 'true'
83
111
  uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
84
112
  with:
85
113
  client-id: ${{ vars.ANKHORAGE_RENOVATE_SYNC_CLIENT_ID }}
@@ -89,18 +117,22 @@ jobs:
89
117
  permission-contents: write
90
118
 
91
119
  - name: Trigger the Devtools consumer rollout
92
- if: steps.changesets.outputs.published == 'true'
120
+ if: steps.release.outputs.versioned == 'true'
93
121
  uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
94
122
  env:
95
- PUBLISHED_PACKAGES: ${{ steps.changesets.outputs.publishedPackages }}
123
+ PUBLISHED_PACKAGE_NAME: ${{ steps.release.outputs.package_name }}
124
+ PUBLISHED_PACKAGE_VERSION: ${{ steps.release.outputs.package_version }}
96
125
  with:
97
126
  github-token: ${{ steps.rollout-token.outputs.token }}
98
127
  script: |
99
- const publishedPackages = JSON.parse(process.env.PUBLISHED_PACKAGES ?? '[]');
100
- const release = publishedPackages.find(
101
- (candidate) => candidate.name === '@ankhorage/devtools',
102
- );
103
- if (!release || !/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/.test(release.version)) {
128
+ const release = {
129
+ name: process.env.PUBLISHED_PACKAGE_NAME,
130
+ version: process.env.PUBLISHED_PACKAGE_VERSION,
131
+ };
132
+ if (
133
+ release.name !== '@ankhorage/devtools' ||
134
+ !/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/.test(release.version)
135
+ ) {
104
136
  throw new Error('Changesets must report one exact published Devtools version.');
105
137
  }
106
138
 
@@ -111,6 +143,6 @@ jobs:
111
143
  client_payload: { version: release.version },
112
144
  });
113
145
 
114
- - name: Skip release
146
+ - name: Skip release tooling
115
147
  if: hashFiles('.changeset/config.json') == ''
116
- run: echo "No Changesets config found; skipping release."
148
+ run: echo "No Changesets config found; skipping versioning and publishing."
@@ -7,13 +7,11 @@ export async function renderWorkflowAsync(sourceUrl, policy) {
7
7
  .replaceAll(BUN_VERSION_TOKEN, policy.bunVersion)
8
8
  .replaceAll(CHANGESETS_PUBLISH_COMMAND_TOKEN, changesetsPolicy.workflowCommands.publish)
9
9
  .replaceAll(CHANGESETS_STATUS_COMMAND_TOKEN, changesetsPolicy.workflowCommands.status)
10
- .replaceAll(CHANGESETS_VERSION_PACKAGES_STATUS_COMMAND_TOKEN, changesetsPolicy.workflowCommands.versionPackagesStatus)
11
10
  .replaceAll(CHANGESETS_VERSION_COMMAND_TOKEN, changesetsPolicy.workflowCommands.version)
12
11
  .replaceAll(NODE_VERSION_TOKEN, policy.nodeVersion);
13
12
  }
14
13
  const BUN_VERSION_TOKEN = '__ANKH_BUN_VERSION__';
15
14
  const CHANGESETS_PUBLISH_COMMAND_TOKEN = '__ANKH_CHANGESETS_PUBLISH_COMMAND__';
16
15
  const CHANGESETS_STATUS_COMMAND_TOKEN = '__ANKH_CHANGESETS_STATUS_COMMAND__';
17
- const CHANGESETS_VERSION_PACKAGES_STATUS_COMMAND_TOKEN = '__ANKH_CHANGESETS_VERSION_PACKAGES_STATUS_COMMAND__';
18
16
  const CHANGESETS_VERSION_COMMAND_TOKEN = '__ANKH_CHANGESETS_VERSION_COMMAND__';
19
17
  const NODE_VERSION_TOKEN = '__ANKH_NODE_VERSION__';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ankhorage/devtools",
3
- "version": "1.11.2",
3
+ "version": "1.11.4",
4
4
  "description": "Shared development tools and repository standards for Ankhorage",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/ankhorage/devtools#readme",
@@ -125,7 +125,7 @@
125
125
  },
126
126
  "devDependencies": {
127
127
  "@ankhorage/ankh": "^0.8.11",
128
- "@ankhorage/doctor": "0.10.7",
128
+ "@ankhorage/doctor": "0.10.8",
129
129
  "@types/bun": "^1.4.1",
130
130
  "@types/node": "^26.4.1",
131
131
  "typescript": "~6.0.3"