Update PPA Packages #943
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Update PPA Packages | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| package: | |
| description: 'Package to upload' | |
| required: false | |
| type: choice | |
| options: | |
| - auto | |
| - all | |
| - cliphist | |
| - dankcalendar-git | |
| - ghostty | |
| - matugen | |
| - niri | |
| - niri-git | |
| - quickshell | |
| - quickshell-git | |
| - xwayland-satellite | |
| - xwayland-satellite-git | |
| default: 'auto' | |
| rebuild_release: | |
| description: 'Release number for rebuilds (e.g., 2, 3, 4 for ppa2, ppa3, ppa4)' | |
| required: false | |
| default: '' | |
| schedule: | |
| - cron: '0 */6 * * *' # Every 6 hours (00:00, 06:00, 12:00, 18:00 UTC) | |
| jobs: | |
| check-updates: | |
| name: Check package/series updates | |
| runs-on: ubuntu-latest | |
| outputs: | |
| has_updates: ${{ steps.check.outputs.has_updates }} | |
| targets: ${{ steps.check.outputs.targets }} | |
| targets_json: ${{ steps.check.outputs.targets_json }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y jq curl git dpkg-dev | |
| sudo wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 | |
| sudo chmod +x /usr/local/bin/yq | |
| - name: Check for updates | |
| id: check | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| chmod +x distro/scripts/ppa/*.sh distro/scripts/common/*.sh | |
| PACKAGE="${{ github.event.inputs.package }}" | |
| REBUILD_RELEASE="${{ github.event.inputs.rebuild_release }}" | |
| if [[ -z "$PACKAGE" ]]; then | |
| PACKAGE="auto" | |
| fi | |
| ARGS=(--package "$PACKAGE" --json) | |
| if [[ -n "$REBUILD_RELEASE" ]]; then | |
| ARGS+=(--rebuild "$REBUILD_RELEASE") | |
| fi | |
| TARGETS_JSON=$(distro/scripts/ppa/ppa-sync-plan.sh "${ARGS[@]}" 2> ppa-audit.log) | |
| cat ppa-audit.log | |
| TARGETS=$(echo "$TARGETS_JSON" | jq -r 'join(" ")') | |
| if [[ "$TARGETS_JSON" != "[]" ]]; then | |
| echo "has_updates=true" >> "$GITHUB_OUTPUT" | |
| echo "targets=$TARGETS" >> "$GITHUB_OUTPUT" | |
| echo "targets_json=$TARGETS_JSON" >> "$GITHUB_OUTPUT" | |
| echo "Package/series targets: $TARGETS" | |
| else | |
| echo "has_updates=false" >> "$GITHUB_OUTPUT" | |
| echo "targets=" >> "$GITHUB_OUTPUT" | |
| echo "targets_json=[]" >> "$GITHUB_OUTPUT" | |
| echo "No package/series uploads needed" | |
| fi | |
| upload-ppa: | |
| name: Upload ${{ matrix.target }} | |
| needs: check-updates | |
| runs-on: ubuntu-latest | |
| if: needs.check-updates.outputs.has_updates == 'true' | |
| timeout-minutes: 120 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| target: ${{ fromJson(needs.check-updates.outputs.targets_json) }} | |
| concurrency: | |
| group: ppa-danklinux-${{ matrix.target }} | |
| cancel-in-progress: false | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install build dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| debhelper \ | |
| devscripts \ | |
| dput \ | |
| lftp \ | |
| build-essential \ | |
| fakeroot \ | |
| dpkg-dev \ | |
| openssh-client \ | |
| jq \ | |
| curl \ | |
| git | |
| sudo wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 | |
| sudo chmod +x /usr/local/bin/yq | |
| - 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: Upload target | |
| env: | |
| TARGET: ${{ matrix.target }} | |
| LAUNCHPAD_SSH_PRIVATE_KEY: ${{ secrets.LAUNCHPAD_SSH_PRIVATE_KEY }} | |
| LAUNCHPAD_SSH_LOGIN: ${{ secrets.LAUNCHPAD_SSH_LOGIN }} | |
| run: | | |
| IFS=':' read -r PACKAGE UBUNTU_SERIES PPA_NUM <<< "$TARGET" | |
| echo "Uploading $PACKAGE to $UBUNTU_SERIES with ppa$PPA_NUM" | |
| bash distro/scripts/ppa/ppa-upload.sh "$PACKAGE" danklinux "$UBUNTU_SERIES" "$PPA_NUM" | |
| - name: Summary | |
| if: always() | |
| run: | | |
| echo "### PPA Package Upload" >> "$GITHUB_STEP_SUMMARY" | |
| echo "" >> "$GITHUB_STEP_SUMMARY" | |
| echo "- **Target:** ${{ matrix.target }}" >> "$GITHUB_STEP_SUMMARY" | |
| echo "- **PPA:** https://launchpad.net/~avengemedia/+archive/ubuntu/danklinux/+packages" >> "$GITHUB_STEP_SUMMARY" | |
| echo "" >> "$GITHUB_STEP_SUMMARY" | |
| echo "Launchpad build state is checked separately after upload." >> "$GITHUB_STEP_SUMMARY" |