mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2026-11-18 22:16:18 -05:00
Merge pull request #701 from yuezk/chore/release-promotion-history
fix: preserve release tag history during promotion
This commit is contained in:
3 files changed
+8
-12
No files matched your search
@@ -28,12 +28,7 @@ options=('!strip' '!lto')
|
||||
pkgver() {
|
||||
cd "${_pkgname_prefix}"
|
||||
|
||||
local version
|
||||
version="$(awk -F '"' '
|
||||
/^\[workspace.package\]$/ { in_workspace = 1; next }
|
||||
in_workspace && /^version = / { print $2; exit }
|
||||
' Cargo.toml)"
|
||||
printf '%s.r%s.g%s\n' "$version" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
|
||||
git describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
|
||||
}
|
||||
|
||||
prepare() {
|
||||
|
||||
@@ -36,13 +36,13 @@ PY
|
||||
|
||||
branch="chore/promote-$tag"
|
||||
git switch -c "$branch" origin/main
|
||||
git merge --no-commit --no-ff "$release_sha"
|
||||
git merge --ff --no-edit "$release_sha"
|
||||
cp "$artifact_dir/flake.nix" "$artifact_dir/flake.lock" .
|
||||
python3 "$script_dir/validate-release-version.py" --version "${tag#v}"
|
||||
# Check against Cargo too: overriding the expectation above is only for artifacts.
|
||||
python3 "$script_dir/validate-release-version.py"
|
||||
git add flake.nix flake.lock
|
||||
if ! git diff --cached --quiet || [[ -f "$(git rev-parse --git-path MERGE_HEAD)" ]]; then
|
||||
git commit -m "release: promote $tag sources and Nix packages together"
|
||||
if ! git diff --cached --quiet; then
|
||||
git commit -m "release: validate Nix packages for $tag"
|
||||
fi
|
||||
echo "Prepared $branch. Review the candidate, push normally, and open one PR against main."
|
||||
echo "Prepared $branch. Open one PR against main and use a regular merge to preserve $tag in main's history."
|
||||
@@ -119,7 +119,7 @@ class SourceSelectionTests(unittest.TestCase):
|
||||
|
||||
|
||||
class PromotionTests(unittest.TestCase):
|
||||
def test_sources_and_flake_are_committed_together_preserving_main_work(self):
|
||||
def test_promotion_keeps_tag_history_and_adds_flake_commit(self):
|
||||
with tempfile.TemporaryDirectory() as temp:
|
||||
root = Path(temp)
|
||||
repo, origin, artifact = root / 'repo', root / 'origin.git', root / 'artifact'
|
||||
@@ -149,7 +149,8 @@ class PromotionTests(unittest.TestCase):
|
||||
self.assertEqual(git(repo, 'show', f'{old}:Cargo.toml'), '[workspace.package]\nversion = "3.1.0"')
|
||||
self.assertTrue((repo / 'infrastructure').exists())
|
||||
self.assertTrue((repo / 'feature').exists())
|
||||
self.assertEqual(git(repo, 'rev-list', '--parents', '-1', 'HEAD').split()[1:], [main, release])
|
||||
self.assertEqual(git(repo, 'rev-list', '--parents', '-1', 'HEAD^').split()[1:], [main, release])
|
||||
self.assertEqual(git(repo, 'diff', '--name-only', 'HEAD^', 'HEAD'), 'flake.nix')
|
||||
self.assertEqual(git(repo, 'status', '--porcelain'), '')
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user