Skip to content

Commit b572d54

Browse files
committed
chore: ci fixes
1 parent 5bb72db commit b572d54

5 files changed

Lines changed: 110 additions & 573 deletions

File tree

.github/workflows/promote-stable.yml

Lines changed: 48 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,19 +68,60 @@ jobs:
6868
if git merge --no-ff --no-edit "origin/${SOURCE_BRANCH}"; then
6969
MERGE_STATUS="clean"
7070
else
71-
# Auto-resolve release artifact conflicts: keep stable's version.
71+
normalize_json_without_keys() {
72+
python3 -c 'import json, sys; data = json.load(sys.stdin); [data.pop(key, None) for key in sys.argv[1:]]; sys.stdout.write(json.dumps(data, sort_keys=True, separators=(",", ":")))' "$@"
73+
}
74+
75+
release_artifact_only_conflict() {
76+
local f="$1"
77+
local tmpdir
78+
local status
79+
tmpdir="$(mktemp -d)"
80+
81+
case "$f" in
82+
package.json|*/package.json)
83+
git show ":2:${f}" | normalize_json_without_keys version > "${tmpdir}/ours" || { rm -rf "${tmpdir}"; return 1; }
84+
git show ":3:${f}" | normalize_json_without_keys version > "${tmpdir}/theirs" || { rm -rf "${tmpdir}"; return 1; }
85+
;;
86+
pyproject.toml|*/pyproject.toml)
87+
git show ":2:${f}" | sed -E '/^[[:space:]]*version[[:space:]]*=/d' > "${tmpdir}/ours" || { rm -rf "${tmpdir}"; return 1; }
88+
git show ":3:${f}" | sed -E '/^[[:space:]]*version[[:space:]]*=/d' > "${tmpdir}/theirs" || { rm -rf "${tmpdir}"; return 1; }
89+
;;
90+
version.json|*/version.json)
91+
git show ":2:${f}" | normalize_json_without_keys version sdkVersion > "${tmpdir}/ours" || { rm -rf "${tmpdir}"; return 1; }
92+
git show ":3:${f}" | normalize_json_without_keys version sdkVersion > "${tmpdir}/theirs" || { rm -rf "${tmpdir}"; return 1; }
93+
;;
94+
*)
95+
rm -rf "${tmpdir}"
96+
return 1
97+
;;
98+
esac
99+
100+
cmp -s "${tmpdir}/ours" "${tmpdir}/theirs"
101+
status=$?
102+
rm -rf "${tmpdir}"
103+
return "${status}"
104+
}
105+
106+
# Auto-resolve release artifact conflicts only when the conflict is
107+
# version-only: keep stable's version, but never drop dependency,
108+
# script, export, or package metadata changes from main.
72109
# npm/PyPI already have stable's published version; downgrading to
73110
# main's track would break the next stable release. Mirrors the
74111
# auto-resolve in sync-patches.yml, biased the other direction.
75-
git diff --name-only --diff-filter=U | while read -r f; do
112+
while read -r f; do
76113
case "$f" in
77114
package.json|*/package.json|pyproject.toml|*/pyproject.toml|version.json|*/version.json)
78-
echo " Auto-resolving $f (keeping stable's version)"
79-
git checkout --ours "$f"
80-
git add "$f"
115+
if release_artifact_only_conflict "$f"; then
116+
echo " Auto-resolving $f (version-only; keeping stable's version)"
117+
git checkout --ours "$f"
118+
git add "$f"
119+
else
120+
echo " Leaving $f unresolved (contains non-version changes)"
121+
fi
81122
;;
82123
esac
83-
done
124+
done < <(git diff --name-only --diff-filter=U)
84125
85126
if [ -z "$(git diff --name-only --diff-filter=U)" ]; then
86127
MERGE_STATUS="auto_resolved"
@@ -138,7 +179,7 @@ jobs:
138179
139180
- creates \`${BRANCH_NAME}\` from \`${BASE_BRANCH}\`
140181
- merges \`${SOURCE_BRANCH}\` into the candidate branch
141-
- release artifact conflicts (package.json, pyproject.toml, version.json) auto-resolved to keep stable's published version
182+
- version-only release artifact conflicts (package.json, pyproject.toml, version.json) auto-resolved to keep stable's published version
142183
143184
---
144185
_Auto-created by promote-stable workflow._

.github/workflows/release-react.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ concurrency:
3636

3737
jobs:
3838
release:
39+
# Stable publishes must go through release-stable.yml.
40+
if: ${{ github.event_name != 'workflow_dispatch' || github.ref_name != 'stable' }}
3941
runs-on: ubuntu-24.04
4042
steps:
4143
- name: Generate token

.github/workflows/release-superdoc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ concurrency:
4040

4141
jobs:
4242
release:
43+
# Stable publishes must go through release-stable.yml; PR previews are still allowed.
44+
if: ${{ github.event_name != 'workflow_dispatch' || github.ref_name != 'stable' || inputs.pr_number }}
4345
runs-on: ubuntu-24.04
4446
steps:
4547
- name: Generate token

.github/workflows/release-vscode-ext.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ concurrency:
3434

3535
jobs:
3636
release:
37+
# Stable publishes must go through release-stable.yml.
38+
if: ${{ github.event_name != 'workflow_dispatch' || github.ref_name != 'stable' }}
3739
runs-on: ubuntu-latest
3840
steps:
3941
- name: Generate token

0 commit comments

Comments
 (0)