mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-25 05:52:50 -05:00
244 lines
11 KiB
YAML
244 lines
11 KiB
YAML
name: Update PPA Packages
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
package:
|
|
description: "Package to upload (dms, dms-git, dms-greeter, or all)"
|
|
required: false
|
|
default: "dms-git"
|
|
force_upload:
|
|
description: "Force upload without version check"
|
|
required: false
|
|
default: "false"
|
|
type: choice
|
|
options:
|
|
- "false"
|
|
- "true"
|
|
rebuild_release:
|
|
description: "Release number for rebuilds (e.g., 2, 3, 4 for ppa2, ppa3, ppa4)"
|
|
required: false
|
|
default: ""
|
|
schedule:
|
|
- cron: "0 */3 * * *" # Every 3 hours for dms-git builds
|
|
|
|
jobs:
|
|
check-updates:
|
|
name: Check for updates
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
|
has_updates: ${{ steps.check.outputs.has_updates }}
|
|
packages: ${{ steps.check.outputs.packages }}
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Check for updates
|
|
id: check
|
|
run: |
|
|
if [[ "${{ github.event_name }}" == "schedule" ]]; then
|
|
echo "packages=dms-git" >> $GITHUB_OUTPUT
|
|
echo "Checking if dms-git source has changed..."
|
|
|
|
# Get current commit hash (8 chars to match PPA version format)
|
|
CURRENT_COMMIT=$(git rev-parse --short=8 HEAD)
|
|
|
|
# Query Launchpad API for last published version
|
|
# Format: 1.0.2+git2528.d336866fppa1
|
|
PPA_VERSION=$(curl -s "https://api.launchpad.net/1.0/~avengemedia/+archive/ubuntu/dms-git?ws.op=getPublishedSources&source_name=dms-git&status=Published" | grep -oP '"source_package_version":\s*"\K[^"]+' | head -1 || echo "")
|
|
|
|
if [[ -n "$PPA_VERSION" ]]; then
|
|
# Extract commit hash from version (e.g., d336866f from 1.0.2+git2528.d336866fppa1)
|
|
PPA_COMMIT=$(echo "$PPA_VERSION" | grep -oP '\.[a-f0-9]{8}' | tr -d '.' || echo "")
|
|
|
|
if [[ -n "$PPA_COMMIT" ]]; then
|
|
if [[ "$CURRENT_COMMIT" == "$PPA_COMMIT" ]]; then
|
|
echo "has_updates=false" >> $GITHUB_OUTPUT
|
|
echo "📋 Commit $CURRENT_COMMIT already uploaded to PPA, skipping"
|
|
else
|
|
echo "has_updates=true" >> $GITHUB_OUTPUT
|
|
echo "📋 New commit detected: $CURRENT_COMMIT (PPA has $PPA_COMMIT)"
|
|
fi
|
|
else
|
|
echo "has_updates=true" >> $GITHUB_OUTPUT
|
|
echo "📋 Could not extract PPA commit, proceeding with upload"
|
|
fi
|
|
else
|
|
echo "has_updates=true" >> $GITHUB_OUTPUT
|
|
echo "📋 No published version found in PPA, proceeding with upload"
|
|
fi
|
|
elif [[ -n "${{ github.event.inputs.package }}" ]]; then
|
|
echo "packages=${{ github.event.inputs.package }}" >> $GITHUB_OUTPUT
|
|
echo "has_updates=true" >> $GITHUB_OUTPUT
|
|
echo "Manual trigger: ${{ github.event.inputs.package }}"
|
|
else
|
|
echo "packages=dms-git" >> $GITHUB_OUTPUT
|
|
echo "has_updates=true" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
upload-ppa:
|
|
name: Upload to PPA
|
|
needs: check-updates
|
|
runs-on: ubuntu-latest
|
|
if: |
|
|
github.event.inputs.force_upload == 'true' ||
|
|
github.event_name == 'workflow_dispatch' ||
|
|
needs.check-updates.outputs.has_updates == 'true'
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: "1.24"
|
|
cache: false
|
|
|
|
- name: Install build dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y \
|
|
debhelper \
|
|
devscripts \
|
|
dput \
|
|
lftp \
|
|
build-essential \
|
|
fakeroot \
|
|
dpkg-dev
|
|
|
|
- name: Configure GPG
|
|
env:
|
|
GPG_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
|
|
run: |
|
|
echo "$GPG_KEY" | gpg --import
|
|
GPG_KEY_ID=$(gpg --list-secret-keys --keyid-format LONG | grep sec | awk '{print $2}' | cut -d'/' -f2)
|
|
echo "DEBSIGN_KEYID=$GPG_KEY_ID" >> $GITHUB_ENV
|
|
|
|
- name: Determine packages to upload
|
|
id: packages
|
|
run: |
|
|
if [[ "${{ github.event.inputs.force_upload }}" == "true" ]]; then
|
|
PKG="${{ github.event.inputs.package }}"
|
|
if [[ -z "$PKG" || "$PKG" == "all" ]]; then
|
|
echo "packages=all" >> $GITHUB_OUTPUT
|
|
echo "🚀 Force upload: all packages"
|
|
else
|
|
echo "packages=$PKG" >> $GITHUB_OUTPUT
|
|
echo "🚀 Force upload: $PKG"
|
|
fi
|
|
elif [[ "${{ github.event_name }}" == "schedule" ]]; then
|
|
echo "packages=${{ needs.check-updates.outputs.packages }}" >> $GITHUB_OUTPUT
|
|
echo "Triggered by schedule: uploading git package"
|
|
elif [[ -n "${{ github.event.inputs.package }}" ]]; then
|
|
# Manual package selection should respect change detection
|
|
SELECTED_PKG="${{ github.event.inputs.package }}"
|
|
UPDATED_PKG="${{ needs.check-updates.outputs.packages }}"
|
|
|
|
# Check if manually selected package is in the updated list
|
|
if [[ "$UPDATED_PKG" == *"$SELECTED_PKG"* ]] || [[ "$SELECTED_PKG" == "all" ]]; then
|
|
echo "packages=$SELECTED_PKG" >> $GITHUB_OUTPUT
|
|
echo "📦 Manual selection (has updates): $SELECTED_PKG"
|
|
else
|
|
echo "packages=" >> $GITHUB_OUTPUT
|
|
echo "⚠️ Manual selection '$SELECTED_PKG' has no updates - skipping (use force_upload to override)"
|
|
fi
|
|
else
|
|
echo "packages=${{ needs.check-updates.outputs.packages }}" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
- name: Upload to PPA
|
|
run: |
|
|
PACKAGES="${{ steps.packages.outputs.packages }}"
|
|
REBUILD_RELEASE="${{ github.event.inputs.rebuild_release }}"
|
|
|
|
if [[ -z "$PACKAGES" ]]; then
|
|
echo "No packages selected for upload. Skipping."
|
|
exit 0
|
|
fi
|
|
|
|
# Build command arguments
|
|
BUILD_ARGS=()
|
|
if [[ -n "$REBUILD_RELEASE" ]]; then
|
|
BUILD_ARGS+=("$REBUILD_RELEASE")
|
|
echo "✓ Using rebuild release number: ppa$REBUILD_RELEASE"
|
|
fi
|
|
|
|
if [[ "$PACKAGES" == "all" ]]; then
|
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
echo "Uploading dms to PPA..."
|
|
if [ -n "$REBUILD_RELEASE" ]; then
|
|
echo "🔄 Using rebuild release number: ppa$REBUILD_RELEASE"
|
|
fi
|
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
bash distro/scripts/ppa-upload.sh dms dms questing "${BUILD_ARGS[@]}"
|
|
|
|
echo ""
|
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
echo "Uploading dms-git to PPA..."
|
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
bash distro/scripts/ppa-upload.sh dms-git dms-git questing "${BUILD_ARGS[@]}"
|
|
|
|
echo ""
|
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
echo "Uploading dms-greeter to PPA..."
|
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
bash distro/scripts/ppa-upload.sh dms-greeter danklinux questing "${BUILD_ARGS[@]}"
|
|
else
|
|
# Map package to PPA name
|
|
case "$PACKAGES" in
|
|
dms)
|
|
PPA_NAME="dms"
|
|
;;
|
|
dms-git)
|
|
PPA_NAME="dms-git"
|
|
;;
|
|
dms-greeter)
|
|
PPA_NAME="danklinux"
|
|
;;
|
|
*)
|
|
PPA_NAME="$PACKAGES"
|
|
;;
|
|
esac
|
|
|
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
echo "Uploading $PACKAGES to PPA..."
|
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
bash distro/scripts/ppa-upload.sh "$PACKAGES" "$PPA_NAME" questing "${BUILD_ARGS[@]}"
|
|
fi
|
|
|
|
- name: Summary
|
|
run: |
|
|
echo "### PPA Package Upload Complete" >> $GITHUB_STEP_SUMMARY
|
|
echo "" >> $GITHUB_STEP_SUMMARY
|
|
echo "- **Packages**: ${{ steps.packages.outputs.packages }}" >> $GITHUB_STEP_SUMMARY
|
|
|
|
if [[ "${{ needs.check-updates.outputs.has_updates }}" == "false" ]]; then
|
|
echo "- **Status**: Skipped (no changes detected)" >> $GITHUB_STEP_SUMMARY
|
|
fi
|
|
|
|
PACKAGES="${{ steps.packages.outputs.packages }}"
|
|
if [[ "$PACKAGES" == "all" ]]; then
|
|
echo "- **PPA dms**: https://launchpad.net/~avengemedia/+archive/ubuntu/dms/+packages" >> $GITHUB_STEP_SUMMARY
|
|
echo "- **PPA dms-git**: https://launchpad.net/~avengemedia/+archive/ubuntu/dms-git/+packages" >> $GITHUB_STEP_SUMMARY
|
|
echo "- **PPA danklinux**: https://launchpad.net/~avengemedia/+archive/ubuntu/danklinux/+packages" >> $GITHUB_STEP_SUMMARY
|
|
elif [[ "$PACKAGES" == "dms" ]]; then
|
|
echo "- **PPA**: https://launchpad.net/~avengemedia/+archive/ubuntu/dms/+packages" >> $GITHUB_STEP_SUMMARY
|
|
elif [[ "$PACKAGES" == "dms-git" ]]; then
|
|
echo "- **PPA**: https://launchpad.net/~avengemedia/+archive/ubuntu/dms-git/+packages" >> $GITHUB_STEP_SUMMARY
|
|
elif [[ "$PACKAGES" == "dms-greeter" ]]; then
|
|
echo "- **PPA**: https://launchpad.net/~avengemedia/+archive/ubuntu/danklinux/+packages" >> $GITHUB_STEP_SUMMARY
|
|
fi
|
|
|
|
if [[ -n "${{ steps.packages.outputs.version }}" ]]; then
|
|
echo "- **Version**: ${{ steps.packages.outputs.version }}" >> $GITHUB_STEP_SUMMARY
|
|
fi
|
|
echo "" >> $GITHUB_STEP_SUMMARY
|
|
echo "Builds will appear once Launchpad processes the uploads." >> $GITHUB_STEP_SUMMARY
|