From d39f4ad267f82aa5721c2442434b590bc3592b7a Mon Sep 17 00:00:00 2001 From: Tommie Gannert Date: Fri, 17 May 2024 11:44:02 +0200 Subject: [PATCH] Upgrades workflows. De-duplicates the Ubuntu version/codename specs to simplify adding distributions. --- .github/workflows/main.yml | 37 ++++++++++++++----------------------- README.md | 4 +--- 2 files changed, 15 insertions(+), 26 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4e17225..26dd45b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -48,7 +48,7 @@ jobs: ) - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: # See https://github.com/marketplace/actions/github-push persist-credentials: false @@ -58,8 +58,9 @@ jobs: id: check-repo-release run: | declare -a new_release_exists + ver_codenames=( $(python3 -c 'import json; import yaml; import sys; json.dump(yaml.safe_load(open(sys.argv[1])), sys.stdout)' .github/workflows/main.yml | jq -r '.jobs."build-deb".strategy.matrix.include[] | .os+"/"+.codename') ) for arch in amd64 armhf arm64; do - for ver_codename in ubuntu-24.04/noble ubuntu-22.04/jammy ubuntu-20.04/focal; do + for ver_codename in "${ver_codenames[@]}"; do ver=${ver_codename%/*} codename=${ver_codename##*/} # Note the leading v to match the Git tag. @@ -136,19 +137,13 @@ jobs: key: ${{ matrix.os }}-amd64 - name: Build Client DEB - uses: actions-rs/cargo@v1 - with: - command: deb - args: -p client --deb-version=${{ needs.check-upstream.outputs.innernet_version }}-0ubuntu0~${{ matrix.codename }} + run: cargo deb -p client --deb-version=${{ needs.check-upstream.outputs.innernet_version }}-0ubuntu0~${{ matrix.codename }} - name: Build Server DEB - uses: actions-rs/cargo@v1 - with: - command: deb - args: -p server --deb-version=${{ needs.check-upstream.outputs.innernet_version }}-0ubuntu0~${{ matrix.codename }} + run: cargo deb -p server --deb-version=${{ needs.check-upstream.outputs.innernet_version }}-0ubuntu0~${{ matrix.codename }} - name: Upload DEBs - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: # Syntax: https://github.com/actions/upload-artifact/issues/22 name: deb ${{ matrix.codename }} ${{ matrix.arch }} @@ -249,19 +244,15 @@ jobs: type -p cargo-deb >/dev/null || cargo install cargo-deb - name: Build Client DEB - uses: actions-rs/cargo@v1 - with: - command: deb - args: -p client --target=${{ matrix.target }} --deb-version=${{ needs.check-upstream.outputs.innernet_version }}-0ubuntu0~${{ steps.config.outputs.codename }} + run: | + cargo deb -p client --target=${{ matrix.target }} --deb-version=${{ needs.check-upstream.outputs.innernet_version }}-0ubuntu0~${{ steps.config.outputs.codename }} - name: Build Server DEB - uses: actions-rs/cargo@v1 - with: - command: deb - args: -p server --target=${{ matrix.target }} --deb-version=${{ needs.check-upstream.outputs.innernet_version }}-0ubuntu0~${{ steps.config.outputs.codename }} + run: | + cargo deb -p server --target=${{ matrix.target }} --deb-version=${{ needs.check-upstream.outputs.innernet_version }}-0ubuntu0~${{ steps.config.outputs.codename }} - name: Upload DEBs - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: # Syntax: https://github.com/actions/upload-artifact/issues/22 name: deb ${{ steps.config.outputs.codename }} ${{ matrix.arch }} @@ -295,7 +286,7 @@ jobs: steps: - name: Download DEBs if: "contains(needs.check-upstream.outputs.new_release_exists, matrix.os)" - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: deb ${{ matrix.codename }} ${{ matrix.arch }} path: ./artifacts @@ -351,14 +342,14 @@ jobs: echo '${{ secrets.GPG_SIGNING_PASSPHRASE }}' | /usr/lib/gnupg/gpg-preset-passphrase --preset 57F0E65446A301CC19914FD61167922350A2D8B2 - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: # See https://github.com/marketplace/actions/github-push persist-credentials: false fetch-depth: 0 - name: Download DEBs - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: path: ./artifacts diff --git a/README.md b/README.md index c0b8449..c302685 100644 --- a/README.md +++ b/README.md @@ -68,9 +68,7 @@ The authoritative source of supported distributions and architectures is [`conf/ When Ubuntu/Debian releases a new version, we need to 1. Add the new distribution in `debian/conf/distributions`. -1. Update `.github/workflows/main.yml` in - * `check-repo-release` to find existing package versions, - * `build-deb` matrix to build on the new version. +1. Add the version and codename to the matrix in `build-deb` in `.github/workflows/main.yml`. ## License