diff --git a/distro/scripts/obs-upload.sh b/distro/scripts/obs-upload.sh index eab2118c..ecb7aa68 100755 --- a/distro/scripts/obs-upload.sh +++ b/distro/scripts/obs-upload.sh @@ -235,7 +235,8 @@ if [[ "$UPLOAD_OPENSUSE" == true ]] && [[ -f "distro/opensuse/$PACKAGE.spec" ]]; OLD_RELEASE=$(grep "^Release:" "$WORK_DIR/.osc/$PACKAGE.spec" | sed 's/^Release:[[:space:]]*//' | sed 's/%{?dist}//' | head -1) if [[ "$NEW_VERSION" == "$OLD_VERSION" ]]; then - if [[ "$IS_MANUAL" == true ]]; then + if [[ "$IS_MANUAL" == true ]] && [[ -z "${GITHUB_ACTIONS:-}" ]] && [[ -z "${CI:-}" ]]; then + # Only error for true local manual runs, not CI/workflow runs if [[ -n "${REBUILD_RELEASE:-}" ]]; then echo " 🔄 Using manual rebuild release number: $REBUILD_RELEASE" sed -i "s/^Release:[[:space:]]*${NEW_RELEASE}%{?dist}/Release: ${REBUILD_RELEASE}%{?dist}/" "$WORK_DIR/$PACKAGE.spec" @@ -249,10 +250,10 @@ if [[ "$UPLOAD_OPENSUSE" == true ]] && [[ -f "distro/opensuse/$PACKAGE.spec" ]]; exit 1 fi else - echo " - Detected same version $NEW_VERSION (release $OLD_RELEASE). Not a manual run, skipping update." + echo " - Detected same version $NEW_VERSION (release $OLD_RELEASE). No changes needed, skipping update." # If this is OpenSUSE only run, we can exit. if [[ "$UPLOAD_DEBIAN" == false ]]; then - echo "✅ No changes needed for OpenSUSE (not manual). Exiting." + echo "✅ No changes needed for OpenSUSE. Exiting." exit 0 fi fi @@ -705,7 +706,17 @@ if [[ "$UPLOAD_DEBIAN" == true ]] && [[ "$SOURCE_FORMAT" == *"native"* ]] && [[ OLD_DSC_BASE=$(echo "$OLD_DSC_VERSION" | sed 's/ppa[0-9]*$//') if [[ -n "$OLD_DSC_VERSION" ]] && [[ "$OLD_DSC_BASE" == "$CHANGELOG_BASE" ]]; then - if [[ "$IS_MANUAL" == true ]]; then + # In CI, skip if version unchanged (matching PPA behavior) + if [[ -n "${GITHUB_ACTIONS:-}" ]] || [[ -n "${CI:-}" ]]; then + if [[ "${FORCE_UPLOAD:-}" != "true" ]] && [[ -z "${REBUILD_RELEASE:-}" ]]; then + echo "==> Same version detected in CI (current: $OLD_DSC_VERSION), skipping upload" + echo " Use force_upload=true or set rebuild_release to override" + exit 0 + fi + fi + + if [[ "$IS_MANUAL" == true ]] && [[ -z "${GITHUB_ACTIONS:-}" ]] && [[ -z "${CI:-}" ]]; then + # Only error for true local manual runs, not CI/workflow runs # Only increment version when explicitly specified via REBUILD_RELEASE if [[ -n "$REBUILD_RELEASE" ]]; then echo "==> Using specified rebuild release: ppa$REBUILD_RELEASE" @@ -718,7 +729,19 @@ if [[ "$UPLOAD_DEBIAN" == true ]] && [[ "$SOURCE_FORMAT" == *"native"* ]] && [[ echo " ./distro/scripts/obs-upload.sh debian $PACKAGE --rebuild=2" exit 1 fi + elif [[ -n "$REBUILD_RELEASE" ]]; then + echo "==> Using specified rebuild release: ppa$REBUILD_RELEASE" + USE_REBUILD_NUM="$REBUILD_RELEASE" + else + echo "==> Error: Same version detected ($CHANGELOG_VERSION) but no rebuild number specified" + echo " To rebuild, explicitly specify a rebuild number:" + echo " ./distro/scripts/obs-upload.sh debian $PACKAGE 2" + echo " or use flag syntax:" + echo " ./distro/scripts/obs-upload.sh debian $PACKAGE --rebuild=2" + exit 1 + fi + if [[ -n "${USE_REBUILD_NUM:-}" ]]; then if [[ "$CHANGELOG_VERSION" =~ ^([0-9.]+)\+git([0-9]+)(\.[a-f0-9]+)?$ ]]; then BASE_VERSION="${BASH_REMATCH[1]}" GIT_NUM="${BASH_REMATCH[2]}" diff --git a/distro/scripts/ppa-build.sh b/distro/scripts/ppa-build.sh index 060ccd9f..6cf998ae 100755 --- a/distro/scripts/ppa-build.sh +++ b/distro/scripts/ppa-build.sh @@ -209,7 +209,8 @@ if [ "$IS_GIT_PACKAGE" = false ] && [ -n "$GIT_REPO" ]; then if [[ "$SOURCE_FORMAT" == *"native"* ]]; then BASE_VERSION="${LATEST_TAG}" if [[ -z "${REBUILD_RELEASE:-}" ]] && [[ "$CURRENT_VERSION" =~ ^${LATEST_TAG}ppa([0-9]+)$ ]]; then - if [[ "$IS_MANUAL" == true ]]; then + if [[ "$IS_MANUAL" == true ]] && [[ -z "${GITHUB_ACTIONS:-}" ]] && [[ -z "${CI:-}" ]]; then + # Only error for true local manual runs, not CI/workflow runs error "Same version detected ($CURRENT_VERSION) but no rebuild number specified" error "To rebuild, explicitly specify a rebuild number:" error " ./distro/scripts/ppa-upload.sh $PACKAGE_NAME 2" @@ -217,7 +218,7 @@ if [ "$IS_GIT_PACKAGE" = false ] && [ -n "$GIT_REPO" ]; then error " ./distro/scripts/ppa-upload.sh $PACKAGE_NAME --rebuild=2" exit 1 else - info "Detected rebuild of same version (current: $CURRENT_VERSION). Not a manual run, skipping." + info "Detected rebuild of same version (current: $CURRENT_VERSION). No changes needed, skipping." success "No changes needed (version matches)." exit 0 fi @@ -229,7 +230,8 @@ if [ "$IS_GIT_PACKAGE" = false ] && [ -n "$GIT_REPO" ]; then BASE_VERSION="${LATEST_TAG}-1" ESCAPED_BASE=$(echo "$BASE_VERSION" | sed 's/\./\\./g' | sed 's/-/\\-/g') if [[ -z "${REBUILD_RELEASE:-}" ]] && [[ "$CURRENT_VERSION" =~ ^${ESCAPED_BASE}ppa([0-9]+)$ ]]; then - if [[ "$IS_MANUAL" == true ]]; then + if [[ "$IS_MANUAL" == true ]] && [[ -z "${GITHUB_ACTIONS:-}" ]] && [[ -z "${CI:-}" ]]; then + # Only error for true local manual runs, not CI/workflow runs error "Same version detected ($CURRENT_VERSION) but no rebuild number specified" error "To rebuild, explicitly specify a rebuild number:" error " ./distro/scripts/ppa-upload.sh $PACKAGE_NAME 2" @@ -237,7 +239,7 @@ if [ "$IS_GIT_PACKAGE" = false ] && [ -n "$GIT_REPO" ]; then error " ./distro/scripts/ppa-upload.sh $PACKAGE_NAME --rebuild=2" exit 1 else - info "Detected rebuild of same version (current: $CURRENT_VERSION). Not a manual run, skipping." + info "Detected rebuild of same version (current: $CURRENT_VERSION). No changes needed, skipping." success "No changes needed (version matches)." exit 0 fi @@ -384,7 +386,8 @@ if [ "$IS_GIT_PACKAGE" = true ] && [ -n "$GIT_REPO" ]; then PPA_NUM=1 ESCAPED_BASE=$(echo "$BASE_VERSION" | sed 's/\./\\./g' | sed 's/+/\\+/g') if [[ "$CURRENT_VERSION" =~ ^${ESCAPED_BASE}ppa([0-9]+)$ ]]; then - if [[ "$IS_MANUAL" == true ]]; then + if [[ "$IS_MANUAL" == true ]] && [[ -z "${GITHUB_ACTIONS:-}" ]] && [[ -z "${CI:-}" ]]; then + # Only error for true local manual runs, not CI/workflow runs error "Same commit detected ($CURRENT_VERSION) but no rebuild number specified" error "To rebuild, explicitly specify a rebuild number:" error " ./distro/scripts/ppa-upload.sh $PACKAGE_NAME 2" @@ -392,7 +395,7 @@ if [ "$IS_GIT_PACKAGE" = true ] && [ -n "$GIT_REPO" ]; then error " ./distro/scripts/ppa-upload.sh $PACKAGE_NAME --rebuild=2" exit 1 else - info "Detected rebuild of same commit (current: $CURRENT_VERSION). Not a manual run, skipping." + info "Detected rebuild of same commit (current: $CURRENT_VERSION). No changes needed, skipping." success "No changes needed (commit matches)." exit 0 fi