mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-10-30 15:07:49 -04:00
- Further banner notices will show once per/shell session in notifications, dms doctor and software updates
- Doc updates to follow
Port 2.0
(cherry picked from commit 095d1c6fd5)
177 lines
6.1 KiB
YAML
177 lines
6.1 KiB
YAML
name: Update PPA Packages
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
package:
|
|
description: "Package to upload"
|
|
required: true
|
|
type: choice
|
|
options:
|
|
- dms
|
|
- dms-git
|
|
- all
|
|
default: "dms"
|
|
rebuild_release:
|
|
description: "Release number for rebuilds (e.g., 2, 3, 4 for ppa2, ppa3, ppa4)"
|
|
required: false
|
|
default: ""
|
|
owners:
|
|
description: "PPA owners to publish to"
|
|
required: false
|
|
default: "all"
|
|
type: choice
|
|
options:
|
|
- all
|
|
- duxlabs
|
|
- avengemedia
|
|
schedule:
|
|
- cron: "0 2,5,14,17,20,23 * * *" # 9am, 12pm, 3pm, 6pm, 9pm, 12am EST (UTC times shown)
|
|
|
|
jobs:
|
|
check-updates:
|
|
name: Check package/series updates
|
|
runs-on: ubuntu-latest
|
|
if: github.repository == 'duxlabs-dev/dux-shell'
|
|
|
|
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
|
|
submodules: recursive
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y jq curl git
|
|
|
|
- name: Check for updates
|
|
id: check
|
|
env:
|
|
OWNERS: ${{ inputs.owners || 'all' }}
|
|
run: |
|
|
chmod +x distro/scripts/ppa-sync-plan.sh
|
|
|
|
if [[ "${{ github.event_name }}" == "schedule" ]]; then
|
|
PACKAGE="dms-git"
|
|
else
|
|
PACKAGE="${{ github.event.inputs.package }}"
|
|
fi
|
|
|
|
REBUILD_RELEASE="${{ github.event.inputs.rebuild_release }}"
|
|
ARGS=(--package "$PACKAGE" --json)
|
|
if [[ -n "$REBUILD_RELEASE" ]]; then
|
|
ARGS+=(--rebuild "$REBUILD_RELEASE")
|
|
fi
|
|
|
|
# Planned per owner: an empty new PPA needs everything, the old one may need nothing.
|
|
TARGETS_JSON='[]'
|
|
: > ppa-audit.log
|
|
for T in duxlabs: avengemedia:_LEGACY; do
|
|
OWNER="${T%%:*}" SUFFIX="${T#*:}"
|
|
[[ "$OWNERS" == all || "$OWNERS" == "$OWNER" ]] || continue
|
|
echo "~${OWNER}:" >> ppa-audit.log
|
|
PLAN=$(PPA_OWNER="$OWNER" distro/scripts/ppa-sync-plan.sh "${ARGS[@]}" 2>> ppa-audit.log)
|
|
TARGETS_JSON=$(jq -c --arg o "$OWNER" --arg s "$SUFFIX" --argjson p "$PLAN" \
|
|
'. + [$p[] | {owner: $o, suffix: $s, target: .}]' <<< "$TARGETS_JSON")
|
|
done
|
|
cat ppa-audit.log
|
|
|
|
TARGETS=$(jq -r 'map(.owner + ":" + .target) | join(" ")' <<< "$TARGETS_JSON")
|
|
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.owner }} ${{ 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:
|
|
include: ${{ fromJson(needs.check-updates.outputs.targets_json) }}
|
|
concurrency:
|
|
group: ppa-dms-${{ matrix.owner }}-${{ matrix.target }}
|
|
cancel-in-progress: false
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
with:
|
|
fetch-depth: 0
|
|
submodules: recursive
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v6
|
|
with:
|
|
go-version-file: ./core/go.mod
|
|
cache-dependency-path: core/go.sum
|
|
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 \
|
|
openssh-client
|
|
|
|
- name: Configure GPG
|
|
env:
|
|
GPG_KEY: ${{ secrets[format('GPG_PRIVATE_KEY{0}', matrix.suffix)] }}
|
|
run: |
|
|
: "${GPG_KEY:?GPG_PRIVATE_KEY${{ matrix.suffix }} is not set}"
|
|
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 }}
|
|
PPA_OWNER: ${{ matrix.owner }}
|
|
LAUNCHPAD_SSH_PRIVATE_KEY: ${{ secrets[format('LAUNCHPAD_SSH_PRIVATE_KEY{0}', matrix.suffix)] }}
|
|
LAUNCHPAD_SSH_LOGIN: ${{ secrets[format('LAUNCHPAD_SSH_LOGIN{0}', matrix.suffix)] }}
|
|
run: |
|
|
: "${LAUNCHPAD_SSH_PRIVATE_KEY:?LAUNCHPAD_SSH_PRIVATE_KEY${{ matrix.suffix }} is not set}" "${LAUNCHPAD_SSH_LOGIN:?LAUNCHPAD_SSH_LOGIN${{ matrix.suffix }} is not set}"
|
|
IFS=':' read -r PACKAGE UBUNTU_SERIES PPA_NUM <<< "$TARGET"
|
|
|
|
case "$PACKAGE" in
|
|
dms) PPA_NAME="dms" ;;
|
|
dms-git) PPA_NAME="dms-git" ;;
|
|
*) echo "::error::Unknown package $PACKAGE"; exit 1 ;;
|
|
esac
|
|
|
|
echo "Uploading $PACKAGE to ~$PPA_OWNER/$PPA_NAME/$UBUNTU_SERIES with ppa$PPA_NUM"
|
|
bash distro/scripts/ppa-upload.sh "$PACKAGE" "$PPA_NAME" "$UBUNTU_SERIES" "$PPA_NUM"
|
|
|
|
- name: Summary
|
|
if: always()
|
|
run: |
|
|
echo "### PPA Package Upload" >> "$GITHUB_STEP_SUMMARY"
|
|
echo "" >> "$GITHUB_STEP_SUMMARY"
|
|
echo "- **Owner:** ${{ matrix.owner }}" >> "$GITHUB_STEP_SUMMARY"
|
|
echo "- **Target:** ${{ matrix.target }}" >> "$GITHUB_STEP_SUMMARY"
|
|
echo "- **DMS PPA:** https://launchpad.net/~${{ matrix.owner }}/+archive/ubuntu/dms/+packages" >> "$GITHUB_STEP_SUMMARY"
|
|
echo "- **DMS-Git PPA:** https://launchpad.net/~${{ matrix.owner }}/+archive/ubuntu/dms-git/+packages" >> "$GITHUB_STEP_SUMMARY"
|