fix: address swallowed exceptions and blocking calls #59
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: Debian Packages | |
| on: | |
| push: | |
| branches: | |
| - squall | |
| workflow_dispatch: | |
| jobs: | |
| setup: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| epoch: ${{ steps.epoch.outputs.epoch }} | |
| steps: | |
| - name: Generate build timestamp | |
| id: epoch | |
| run: echo "epoch=$(date +%s)" >> $GITHUB_OUTPUT | |
| build-deb: | |
| needs: setup | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| strategy: | |
| matrix: | |
| include: | |
| - distro: debian | |
| version: trixie | |
| image: debian:trixie | |
| - distro: ubuntu | |
| version: noble | |
| image: ubuntu:24.04 | |
| container: | |
| image: ${{ matrix.image }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Enable universe (Ubuntu only) | |
| if: matrix.distro == 'ubuntu' | |
| run: | | |
| apt-get update | |
| apt-get install -y software-properties-common | |
| add-apt-repository -y universe | |
| - name: Install build dependencies | |
| run: | | |
| apt-get update | |
| apt-get install -y --no-install-recommends \ | |
| build-essential \ | |
| debhelper \ | |
| dh-virtualenv \ | |
| intltool \ | |
| python3 \ | |
| python3-dev \ | |
| python3-gi \ | |
| python3-gi-cairo \ | |
| python3-libtorrent \ | |
| unzip | |
| - name: Inject build version | |
| env: | |
| EPOCH: ${{ needs.setup.outputs.epoch }} | |
| CODENAME: ${{ matrix.version }} | |
| run: | | |
| PKG_VER=$(dpkg-parsechangelog -S Version) | |
| BASE_VER="${PKG_VER%-*}" | |
| NEW_VER="${BASE_VER}+${CODENAME}.${EPOCH}-1" | |
| sed -i "1s/${PKG_VER}/${NEW_VER}/" debian/changelog | |
| - name: Build packages | |
| run: dpkg-buildpackage -us -uc -b | |
| - name: Rename to debrepo format | |
| env: | |
| CODENAME: ${{ matrix.version }} | |
| run: | | |
| mkdir -p dist | |
| for deb in ../*.deb; do | |
| base=$(basename "$deb") | |
| pkg=$(echo "$base" | cut -d_ -f1) | |
| ver_rev=$(echo "$base" | cut -d_ -f2) | |
| arch=$(echo "$base" | cut -d_ -f3 | sed 's/\.deb//') | |
| ver=$(echo "$ver_rev" | sed 's/-[^-]*$//') | |
| mv "$deb" "dist/${pkg}_${ver}_${CODENAME}_${arch}.deb" | |
| done | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: debs-${{ matrix.distro }}-${{ matrix.version }} | |
| path: dist/*.deb | |
| publish: | |
| needs: [setup, build-deb] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| merge-multiple: true | |
| - name: Get release tag | |
| id: tag | |
| env: | |
| EPOCH: ${{ needs.setup.outputs.epoch }} | |
| run: | | |
| PKG_VER=$(dpkg-parsechangelog -S Version) | |
| BASE_VER="${PKG_VER%-*}" | |
| VERSION=$(echo "${BASE_VER}+${EPOCH}" | sed 's/~/./' | sed 's/+/./') | |
| echo "tag=squall-${VERSION}" >> $GITHUB_OUTPUT | |
| - name: Publish to GitHub release | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| TAG: ${{ steps.tag.outputs.tag }} | |
| run: | | |
| gh release create "$TAG" \ | |
| --title "Squall packages ($TAG)" \ | |
| --prerelease \ | |
| --notes "Automated deb build" 2>/dev/null || true | |
| gh release upload "$TAG" dist/*.deb --clobber | |
| - name: Prune old releases (keep latest 3) | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| gh release list --json tagName --jq '.[].tagName' \ | |
| | grep '^squall-' \ | |
| | tail -n +4 \ | |
| | xargs -I{} gh release delete {} --yes --cleanup-tag |