code-foundry 0.27.16 → 0.27.18
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/.github/workflows/release.yml +88 -0
- package/CHANGELOG.md +14 -0
- package/docs/RELEASES.md +12 -5
- package/package.json +1 -1
|
@@ -71,6 +71,16 @@ jobs:
|
|
|
71
71
|
`release_type=${releaseType}\nlegacy_release_type=${legacyReleaseType}\nnpm_publish=${npmPublish}\n`,
|
|
72
72
|
)
|
|
73
73
|
NODE
|
|
74
|
+
- name: Detect release credentials
|
|
75
|
+
id: credentials
|
|
76
|
+
env:
|
|
77
|
+
RELEASE_PLEASE_TOKEN: ${{ secrets.RELEASE_PLEASE_TOKEN }}
|
|
78
|
+
run: |
|
|
79
|
+
if [ -n "$RELEASE_PLEASE_TOKEN" ]; then
|
|
80
|
+
echo "auto_merge=true" >> "$GITHUB_OUTPUT"
|
|
81
|
+
else
|
|
82
|
+
echo "auto_merge=false" >> "$GITHUB_OUTPUT"
|
|
83
|
+
fi
|
|
74
84
|
- name: Release Please
|
|
75
85
|
id: release
|
|
76
86
|
if: steps.profile.outputs.release_type != 'none'
|
|
@@ -79,6 +89,84 @@ jobs:
|
|
|
79
89
|
token: ${{ secrets.RELEASE_PLEASE_TOKEN || github.token }}
|
|
80
90
|
config-file: release-please-config.json
|
|
81
91
|
release-type: ${{ steps.profile.outputs.legacy_release_type }}
|
|
92
|
+
- name: Leave release pull request for manual merge
|
|
93
|
+
if: steps.release.outputs.prs_created == 'true' && steps.credentials.outputs.auto_merge != 'true'
|
|
94
|
+
run: |
|
|
95
|
+
echo "::notice title=Manual release merge required::Release Please created or updated a version pull request. RELEASE_PLEASE_TOKEN is not configured, so Code Foundry skipped guarded auto-merge. Configure the token before merging when downstream release workflows must run automatically."
|
|
96
|
+
- name: Merge generated version pull requests
|
|
97
|
+
if: steps.release.outputs.prs_created == 'true' && steps.credentials.outputs.auto_merge == 'true'
|
|
98
|
+
env:
|
|
99
|
+
GH_TOKEN: ${{ secrets.RELEASE_PLEASE_TOKEN }}
|
|
100
|
+
run: |
|
|
101
|
+
set -euo pipefail
|
|
102
|
+
|
|
103
|
+
allowed_paths="$(
|
|
104
|
+
node <<'NODE'
|
|
105
|
+
const fs = require('node:fs')
|
|
106
|
+
const config = JSON.parse(fs.readFileSync('release-please-config.json', 'utf8'))
|
|
107
|
+
const common = [
|
|
108
|
+
'.release-please-manifest.json',
|
|
109
|
+
'CHANGELOG.md',
|
|
110
|
+
'Cargo.lock',
|
|
111
|
+
'Cargo.toml',
|
|
112
|
+
'bun.lock',
|
|
113
|
+
'bun.lockb',
|
|
114
|
+
'package-lock.json',
|
|
115
|
+
'package.json',
|
|
116
|
+
'pnpm-lock.yaml',
|
|
117
|
+
'pyproject.toml',
|
|
118
|
+
'uv.lock',
|
|
119
|
+
'version.txt',
|
|
120
|
+
'yarn.lock',
|
|
121
|
+
]
|
|
122
|
+
const allowed = new Set(common)
|
|
123
|
+
const addExtraFiles = (files = [], prefix = '') => {
|
|
124
|
+
for (const entry of files) {
|
|
125
|
+
const path = typeof entry === 'string' ? entry : entry.path
|
|
126
|
+
if (path) allowed.add(prefix ? `${prefix}/${path}` : path)
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
addExtraFiles(config['extra-files'])
|
|
130
|
+
for (const [directory, packageConfig] of Object.entries(config.packages || {})) {
|
|
131
|
+
const prefix = directory === '.' ? '' : directory.replace(/\/$/, '')
|
|
132
|
+
for (const path of common) allowed.add(prefix ? `${prefix}/${path}` : path)
|
|
133
|
+
addExtraFiles(packageConfig['extra-files'], prefix)
|
|
134
|
+
}
|
|
135
|
+
process.stdout.write(JSON.stringify([...allowed]))
|
|
136
|
+
NODE
|
|
137
|
+
)"
|
|
138
|
+
|
|
139
|
+
mapfile -t release_prs < <(
|
|
140
|
+
gh pr list \
|
|
141
|
+
--repo "$GITHUB_REPOSITORY" \
|
|
142
|
+
--state open \
|
|
143
|
+
--base main \
|
|
144
|
+
--json number,title,headRefName \
|
|
145
|
+
--jq '.[] | select(.title | startswith("chore(main): release ")) | select(.headRefName | startswith("release-please--branches--main")) | .number'
|
|
146
|
+
)
|
|
147
|
+
[ "${#release_prs[@]}" -gt 0 ] || {
|
|
148
|
+
echo "Release Please reported a pull request, but no generated release PR was found." >&2
|
|
149
|
+
exit 1
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
for pr in "${release_prs[@]}"; do
|
|
153
|
+
mapfile -t changed_paths < <(gh pr diff "$pr" --repo "$GITHUB_REPOSITORY" --name-only)
|
|
154
|
+
[ "${#changed_paths[@]}" -gt 0 ] || {
|
|
155
|
+
echo "Generated release PR #$pr has no changed files." >&2
|
|
156
|
+
exit 1
|
|
157
|
+
}
|
|
158
|
+
for path in "${changed_paths[@]}"; do
|
|
159
|
+
jq -e --arg path "$path" 'index($path) != null' <<<"$allowed_paths" >/dev/null || {
|
|
160
|
+
echo "Refusing to auto-merge release PR #$pr with unexpected path: $path" >&2
|
|
161
|
+
exit 1
|
|
162
|
+
}
|
|
163
|
+
done
|
|
164
|
+
gh pr merge "$pr" \
|
|
165
|
+
--repo "$GITHUB_REPOSITORY" \
|
|
166
|
+
--admin \
|
|
167
|
+
--rebase \
|
|
168
|
+
--delete-branch
|
|
169
|
+
done
|
|
82
170
|
|
|
83
171
|
npm:
|
|
84
172
|
name: Release / Publish npm
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.27.18](https://github.com/0xPlayerOne/code-foundry/compare/v0.27.17...v0.27.18) (2026-07-29)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **release:** degrade gracefully without release token ([69ac43a](https://github.com/0xPlayerOne/code-foundry/commit/69ac43acfa2813495b8da0535942afbbedae3017))
|
|
9
|
+
|
|
10
|
+
## [0.27.17](https://github.com/0xPlayerOne/code-foundry/compare/v0.27.16...v0.27.17) (2026-07-29)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* **release:** auto-merge generated version PRs ([3032cfc](https://github.com/0xPlayerOne/code-foundry/commit/3032cfc458e4508ad637354ee98447c544a5a1d4))
|
|
16
|
+
|
|
3
17
|
## [0.27.16](https://github.com/0xPlayerOne/code-foundry/compare/v0.27.15...v0.27.16) (2026-07-29)
|
|
4
18
|
|
|
5
19
|
### Bug Fixes
|
package/docs/RELEASES.md
CHANGED
|
@@ -29,8 +29,8 @@ body. Existing `CHANGELOG.md` history remains repository-owned.
|
|
|
29
29
|
Set these values in `.github/code-foundry.yml`:
|
|
30
30
|
|
|
31
31
|
```yaml
|
|
32
|
-
release_type: auto
|
|
33
|
-
npm_publish: false
|
|
32
|
+
release_type: auto # auto, node, python, rust, simple, or none
|
|
33
|
+
npm_publish: false # true only for an npm package
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
`auto` selects a supported manifest. Use `simple` with `version.txt` for a
|
|
@@ -39,9 +39,16 @@ not release automatically.
|
|
|
39
39
|
|
|
40
40
|
## Pull request permissions
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
Release Please falls back to the repository's `GITHUB_TOKEN` when a
|
|
43
|
+
`RELEASE_PLEASE_TOKEN` secret is unavailable. In that mode, Code Foundry opens
|
|
44
|
+
or updates the version pull request, leaves it for manual merge, and completes
|
|
45
|
+
the release job successfully.
|
|
46
|
+
|
|
47
|
+
Configure a narrowly scoped `RELEASE_PLEASE_TOKEN` repository or organization
|
|
48
|
+
secret to enable guarded automatic merging and downstream workflows triggered
|
|
49
|
+
by the resulting release. The token needs `contents`, `issues`, and
|
|
50
|
+
`pull-requests` write permissions. Code Foundry validates every changed path in
|
|
51
|
+
the generated version pull request before using the token to merge it.
|
|
45
52
|
|
|
46
53
|
## Operational checklist
|
|
47
54
|
|
package/package.json
CHANGED