diff --git a/.github/workflows/ppa-automation.yaml b/.github/workflows/ppa-automation.yaml index 15485ab9b7..cd85dc4cb1 100644 --- a/.github/workflows/ppa-automation.yaml +++ b/.github/workflows/ppa-automation.yaml @@ -32,13 +32,29 @@ jobs: sudo apt-get update sudo apt-get install golang debhelper devscripts dput-ng -y - - name: Build source bundle - id: gen-source + - name: Decision + id: decision shell: bash env: GITREF: ${{github.ref}} run: | - ./scripts/linux/script.sh --source --gitref ${GITREF} + git clone --depth 1 -b ubuntu/devel git://git.launchpad.net/ubuntu/+source/distro-info-data + echo -n "releases" >> $GITHUB_OUTPUT + tail -n+2 distro-info-data/ubuntu.csv | while read -r line; do + IFS=',' read -ra data <<< "$line" + now=$(date +%s) + if [ $(date -d "${data[5]}" +%s) -lt $now ]; then + echo "Ignoring release ${data[2]} -> eol ${data[5]}" + continue # Ignore EOL releases + fi + if [ $(date -d "${data[4]}" +%s) -gt $((now + 5184000)) ]; then + echo "Ignoring release ${data[2]} -> unreleased ${data[4]}" + continue # Ignore releases more than 60 days in the future + fi + echo "Targeting release ${data[2]}" + echo -n "${data[2]} " >> $GITHUB_OUTPUT + done + echo "" >> $GITHUB_OUTPUT if [[ "$GITREF" == "refs/heads/main" ]]; then echo "ppa-url=ppa:okirby/mozilla-vpn-nightly" >> $GITHUB_OUTPUT @@ -50,18 +66,23 @@ jobs: echo "submit-changes=true" >> $GITHUB_OUTPUT fi + - name: Build source bundle + id: gen-source + shell: bash + run: ./scripts/linux/script.sh --source --gitref ${{github.ref}} + - name: Push to Launchpad PPA shell: bash working-directory: .tmp - if: ${{ steps.gen-source.outputs.submit-changes == 'true' }} + if: ${{ steps.decision.outputs.submit-changes == 'true' }} env: DEBEMAIL: ${{ github.actor }}@users.noreply.github.com DEBFULLNAME: ${{ github.actor }} GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }} GNUPGHOME: ${{ runner.temp }}/gnupg-data - PPA_TARGET_DISTS: focal jammy noble - PPA_URL: ${{ steps.gen-source.outputs.ppa-url }} + PPA_TARGET_DISTS: ${{ steps.decision.outputs.releases }} + PPA_URL: ${{ steps.decision.outputs.ppa-url }} run: | mkdir -m700 $GNUPGHOME echo "allow-preset-passphrase" > $GNUPGHOME/gpg-agent.conf