diff --git a/.github/workflows/sync-aur-edge.yml b/.github/workflows/sync-aur-edge.yml index 0891dfb..cfa1aed 100644 --- a/.github/workflows/sync-aur-edge.yml +++ b/.github/workflows/sync-aur-edge.yml @@ -56,3 +56,15 @@ jobs: delete-branch: true labels: automated reviewers: ryanrhughes + + - name: Notify Basecamp on failure + if: failure() && env.BASECAMP_CHATBOT_URL != '' + env: + BASECAMP_CHATBOT_URL: ${{ secrets.BASECAMP_CHATBOT_URL }} + run: | + curl -s -o /dev/null \ + -H "Content-Type: application/json" \ + -d "$(jq -n --arg content \ + "🔴 AUR sync failed (edge)
View run" \ + '{content: $content}')" \ + "$BASECAMP_CHATBOT_URL" diff --git a/.github/workflows/sync-aur-shared.yml b/.github/workflows/sync-aur-shared.yml index 652afbd..ba2461b 100644 --- a/.github/workflows/sync-aur-shared.yml +++ b/.github/workflows/sync-aur-shared.yml @@ -48,3 +48,15 @@ jobs: git add -A git commit -m "chore: sync AUR packages (shared)" git push + + - name: Notify Basecamp on failure + if: failure() && env.BASECAMP_CHATBOT_URL != '' + env: + BASECAMP_CHATBOT_URL: ${{ secrets.BASECAMP_CHATBOT_URL }} + run: | + curl -s -o /dev/null \ + -H "Content-Type: application/json" \ + -d "$(jq -n --arg content \ + "🔴 AUR sync failed (shared)
View run" \ + '{content: $content}')" \ + "$BASECAMP_CHATBOT_URL" diff --git a/bin/release b/bin/release index 8281a7b..014aec6 100755 --- a/bin/release +++ b/bin/release @@ -6,6 +6,7 @@ set -e BUILD_ROOT=$(realpath "${BASH_SOURCE[0]%/*}/..") source "$BUILD_ROOT/helpers/message-helpers.sh" source "$BUILD_ROOT/helpers/paths.sh" +source "$BUILD_ROOT/helpers/basecamp-notifier.sh" SYNC_REMOTE="" SKIP_PROD_CHECK=false @@ -82,6 +83,7 @@ echo "" print_info "Step 1/6: Building packages..." "$BUILD_ROOT/bin/build" "${BUILD_ARGS[@]}" || { print_error "Build failed" + notify_error "Release failed: Build step failed" "Mirror: $MIRROR | Arch: $ARCH" exit 1 } @@ -90,6 +92,7 @@ echo "" print_info "Step 2/6: Signing packages..." "$BUILD_ROOT/bin/sign" --arch "$ARCH" --mirror "$MIRROR" || { print_error "Signing failed" + notify_error "Release failed: Signing step failed" "Mirror: $MIRROR | Arch: $ARCH" exit 1 } @@ -98,6 +101,7 @@ echo "" print_info "Step 3/6: Promoting to production..." "$BUILD_ROOT/bin/promote-build" --arch "$ARCH" --mirror "$MIRROR" || { print_error "Promotion failed" + notify_error "Release failed: Promotion step failed" "Mirror: $MIRROR | Arch: $ARCH" exit 1 } @@ -106,6 +110,7 @@ echo "" print_info "Step 4/6: Cleaning old versions..." "$BUILD_ROOT/bin/clean-repo" --arch "$ARCH" --mirror "$MIRROR" || { print_error "Cleaning failed" + notify_error "Release failed: Clean step failed" "Mirror: $MIRROR | Arch: $ARCH" exit 1 } @@ -114,6 +119,7 @@ echo "" print_info "Step 5/6: Updating repository database..." "$BUILD_ROOT/bin/update-repo" --arch "$ARCH" --mirror "$MIRROR" || { print_error "Database update failed" + notify_error "Release failed: Database update step failed" "Mirror: $MIRROR | Arch: $ARCH" exit 1 } @@ -129,6 +135,7 @@ if [[ "$SKIP_PROD_CHECK" == true ]]; then fi "$BUILD_ROOT/bin/sync-repo" "${SYNC_ARGS[@]}" || { print_error "Sync failed" + notify_error "Release failed: Sync step failed" "Mirror: $MIRROR | Arch: $ARCH" exit 1 } diff --git a/helpers/basecamp-notifier.sh b/helpers/basecamp-notifier.sh new file mode 100644 index 0000000..c48cda3 --- /dev/null +++ b/helpers/basecamp-notifier.sh @@ -0,0 +1,33 @@ +# Send notifications to Basecamp Campfire via chatbot +# +# Requires BASECAMP_CHATBOT_URL environment variable to be set. +# This is the full chatbot lines URL from Basecamp, e.g.: +# https://3.basecamp.com//integrations//buckets//chats//lines +# +# If BASECAMP_CHATBOT_URL is not set, notifications are silently skipped. + +notify_basecamp() { + local content="$1" + + if [[ -z "${BASECAMP_CHATBOT_URL:-}" ]]; then + return 0 + fi + + curl -s -o /dev/null \ + -H "Content-Type: application/json" \ + -d "$(jq -n --arg content "$content" '{content: $content}')" \ + "$BASECAMP_CHATBOT_URL" 2>/dev/null || true +} + +notify_error() { + local title="$1" + local details="${2:-}" + + local content="🔴 ${title}" + if [[ -n "$details" ]]; then + content+="
${details}" + fi + + notify_basecamp "$content" +} +