diff --git a/.github/workflows/check-kernel-release.yml b/.github/workflows/check-kernel-release.yml index 101fc33c..a067edaa 100644 --- a/.github/workflows/check-kernel-release.yml +++ b/.github/workflows/check-kernel-release.yml @@ -25,6 +25,7 @@ jobs: - name: Fetch kernel.org and check for 6.12 release id: check run: | + set -e -o pipefail # Fetch the kernel.org frontpage and extract 6.12 version CURRENT_VERSION=$(curl -s https://www.kernel.org/ | grep -oP '6\.12\.\d+' | head -n1) @@ -56,6 +57,7 @@ jobs: - name: Set up git credentials if: steps.check.outputs.new_release == 'true' run: | + set -e -o pipefail git config --global user.email "ael-bot@users.noreply.github.com" git config --global user.name "ael-bot" @@ -68,6 +70,7 @@ jobs: env: GIT_TERMINAL_PROMPT: 0 run: | + set -e -o pipefail ./utils/kernel-upgrade.sh linux - name: Create pull request diff --git a/utils/kernel-upgrade.sh b/utils/kernel-upgrade.sh index 2607911d..ce07927a 100755 --- a/utils/kernel-upgrade.sh +++ b/utils/kernel-upgrade.sh @@ -6,7 +6,7 @@ # Usage: ./utils/kernel-upgrade.sh # -set -e +set -e -o pipefail # Parse arguments if [ $# -ne 1 ]; then @@ -139,15 +139,6 @@ rebase_kernel() { log_info "Run 'git rebase --abort' to cancel or resolve conflicts manually" exit 1 fi - - # Push rebased branch to kkit remote - log_info "Pushing rebased branch to $KKIT_REMOTE..." - if git -C "$LINUX_DIR" push "$KKIT_REMOTE" "$LINUX_BRANCH" --force-with-lease; then - log_info "Successfully pushed to $KKIT_REMOTE" - else - log_error "Push failed" - exit 1 - fi } # Update infix and run kernel refresh @@ -195,8 +186,8 @@ update_infix() { # Check if versions are the same if [ "$OLD_VERSION" = "$NEW_VERSION" ]; then - log_info "Kernel version unchanged ($OLD_VERSION), skipping refresh" - return 0 + log_info "Kernel version unchanged ($OLD_VERSION), nothing to do" + exit 0 fi # Run kernel refresh script @@ -231,6 +222,16 @@ update_infix() { else log_warn "doc/ChangeLog.md not found, skipping changelog update" fi + + # Commit all changes + log_info "Committing changes to infix..." + git -C "$INFIX_DIR" add -A + if git -C "$INFIX_DIR" diff-index --quiet HEAD --; then + log_info "No changes to commit" + else + git -C "$INFIX_DIR" commit -m "Upgrade Linux kernel to $NEW_VERSION" + log_info "Changes committed" + fi } # Check for uncommitted changes @@ -254,6 +255,29 @@ check_clean_working_tree() { log_info "Working tree is clean" } +# Push changes to remotes +push_changes() { + log_info "Pushing changes to remotes..." + + # Push rebased linux branch to kkit remote + log_info "Pushing rebased linux branch to $KKIT_REMOTE..." + if git -C "$LINUX_DIR" push "$KKIT_REMOTE" "$LINUX_BRANCH" --force-with-lease; then + log_info "Successfully pushed linux branch to $KKIT_REMOTE" + else + log_error "Push to linux remote failed" + exit 1 + fi + + # Push infix branch to origin + log_info "Pushing infix branch to origin..." + if git -C "$INFIX_DIR" push origin "$INFIX_BRANCH"; then + log_info "Successfully pushed infix branch to origin" + else + log_error "Push to infix remote failed" + exit 1 + fi +} + # Main execution main() { log_info "Starting automated kernel upgrade test..." @@ -265,6 +289,7 @@ main() { update_linux_kernel rebase_kernel update_infix + push_changes log_info "Kernel upgrade completed successfully!" }