Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(linux): pushing of updated changelog branch 🍒 🏠 #12819

Merged
merged 3 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion linux/scripts/debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ for proj in ${projects}; do
EXTRA_ARGS="--distribution ${DIST} --force-distribution"
fi
# shellcheck disable=SC2086
dch --newversion "${version}-${DEBREVISION-1}" ${EXTRA_ARGS} "Re-release to Debian"
dch --newversion "${version}-${DEBREVISION-1}" ${EXTRA_ARGS} ""
debuild -d -S -sa -Zxz
cd "${BASEDIR}"
done
37 changes: 23 additions & 14 deletions linux/scripts/upload-to-debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,21 +92,28 @@ function get_latest_stable_branch_name() {
echo "${stable_branch##* }"
}

# Push the changelog changes to GitHub and create a PR. Returns the PR#
# in the environment variable PR_NUMBER.
function push_to_github_and_create_pr() {
local BRANCH=$1
local BASE=$2
local COMMIT_MSG=$3
local PR_MSG=$4
local pr_number
local BRANCH=$1 # `chore/linux/changelog` or `chore/linux/cherry-pick/changelog`
local BASE=$2 # stable branch, `beta` or `master`
local PR_TITLE=$3 # `Update debian changelog`
local PR_BODY=$4 # `@keymanapp-test-bot skip`

if [[ -n "${PUSH}" ]]; then
${NOOP} git push --force-with-lease origin "${BRANCH}"
pr_number=$(gh pr list --draft --search "${COMMIT_MSG}" --base "${BASE}" --json number --jq '.[].number')
if [[ -n ${pr_number} ]]; then
builder_echo "PR #${pr_number} already exists"
else
${NOOP} gh pr create --draft --base "${BASE}" --title "${PR_MSG}" --body "@keymanapp-test-bot skip"
fi
# Push to origin. We force push to reset the branch the commit we just made.
# There shouldn't be any other commits on ${BRANCH} except the one we want to replace
# (if any).
${NOOP} git push --force origin "${BRANCH}"
PR_NUMBER=$(gh pr list --draft --search "${PR_TITLE}" --base "${BASE}" --json number --jq '.[].number')
if [[ -n ${PR_NUMBER} ]]; then
builder_echo "PR #${PR_NUMBER} already exists"
else
${NOOP} gh pr create --draft --base "${BASE}" --title "${PR_TITLE}" --body "${PR_BODY}"
PR_NUMBER=$(gh pr list --draft --search "${PR_TITLE}" --base "${BASE}" --json number --jq '.[].number')
fi
else
PR_NUMBER=""
fi
}

Expand Down Expand Up @@ -142,12 +149,14 @@ cp debianpackage/keyman-*/debian/changelog debian/
git add debian/changelog
COMMIT_MESSAGE="chore(linux): Update debian changelog"
git commit -m "${COMMIT_MESSAGE}"
push_to_github_and_create_pr chore/linux/changelog "${DEPLOY_BRANCH#origin/}" "${COMMIT_MESSAGE}" "${COMMIT_MESSAGE}"
push_to_github_and_create_pr chore/linux/changelog "${DEPLOY_BRANCH#origin/}" "${COMMIT_MESSAGE}" "@keymanapp-test-bot skip"

# Create cherry-pick on master branch
git checkout -B chore/linux/cherry-pick/changelog origin/master
git cherry-pick -x chore/linux/changelog
push_to_github_and_create_pr chore/linux/cherry-pick/changelog master "${COMMIT_MESSAGE}" "${COMMIT_MESSAGE} 🍒"
push_to_github_and_create_pr chore/linux/cherry-pick/changelog master "${COMMIT_MESSAGE} 🍒" \
"Cherry-pick-of: #${PR_NUMBER}
@keymanapp-test-bot skip"

builder_heading "Finishing"
git checkout "${CURRENT_BRANCH}"
Loading