Skip to content

Commit 169cc0a

Browse files
committed
ci: Bring back stepwise vendoring
1 parent e05dcf8 commit 169cc0a

File tree

2 files changed

+33
-26
lines changed

2 files changed

+33
-26
lines changed

Diff for: .github/workflows/vendor.yaml

+19-23
Original file line numberDiff line numberDiff line change
@@ -35,33 +35,29 @@ jobs:
3535

3636
- uses: ./.github/workflows/git-identity
3737

38-
- name: Check out or create vendor branch
38+
- name: Vendor sources
3939
id: vendor
4040
run: |
41-
set -x
42-
if ! git checkout vendor; then
43-
git checkout -b vendor
44-
git push -u origin HEAD
41+
git pull --rebase
42+
./vendor-one.sh .git/duckdb
43+
rm -rf .git/duckdb
44+
git push --dry-run
45+
# Check if ahead of upstream branch
46+
# If yes, set a step output
47+
if [ $(git rev-list HEAD...origin/main --count) -gt 0 ]; then
48+
# Avoid set-output, it's deprecated
49+
echo "vendor=ok" >> "$GITHUB_OUTPUT"
4550
fi
4651
47-
- name: Vendor sources
52+
- name: Create PR
53+
if: steps.vendor.outputs.vendor != ''
4854
env:
4955
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5056
run: |
51-
git push --dry-run
52-
53-
# Repeat indefinitely until all commits have been vendored
54-
# https://stackoverflow.com/a/13252187/946850
55-
while :; do
56-
./vendor-one.sh .git/duckdb
57-
# Check if ahead of upstream branch
58-
# If yes, push and run workflow
59-
if [ $(git rev-list HEAD...origin/vendor --count) -gt 0 ]; then
60-
git push -u origin HEAD
61-
gh workflow run rcc -f ref=vendor
62-
else
63-
break
64-
fi
65-
done
66-
67-
rm -rf .git/duckdb
57+
set -x
58+
git checkout -b vendor
59+
if git push -u origin HEAD; then
60+
gh pr create --fill-first
61+
gh workflow run rcc -f ref=vendor
62+
gh pr merge --auto --squash
63+
fi

Diff for: vendor-one.sh

+14-3
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,19 @@ if [ "$message" = "" ]; then
7171
exit 0
7272
fi
7373

74+
our_tag=$(git describe --tags --abbrev=0 | sed -r 's/-[0-9]$//')
75+
upstream_tag=$(git -C "$upstream_dir" describe --tags --abbrev=0)
76+
77+
echo "Our tag: $our_tag"
78+
echo "Upstream tag: $upstream_tag"
79+
80+
if [ -z "${is_tag}" -a "${our_tag#$upstream_tag}" == "$our_tag" ]; then
81+
echo "Not vendoring because our tag $our_tag does not start with upstream tag $upstream_tag"
82+
git checkout -- src/duckdb
83+
rm -rf "$upstream_dir"
84+
exit 0
85+
fi
86+
7487
git add .
7588

7689
(
@@ -79,6 +92,4 @@ git add .
7992
git -C "$upstream_dir" log --first-parent --format="%s" ${base}..${commit} | tee /dev/stderr | sed -r 's%(#[0-9]+)%duckdb/duckdb\1%g'
8093
) | git commit --file /dev/stdin
8194

82-
if [ "$upstream_basedir" != ".git/duckdb" ]; then
83-
rm -rf "$upstream_dir"
84-
fi
95+
rm -rf "$upstream_dir"

0 commit comments

Comments
 (0)