First checks for new releases.

It's annoying that reprepro includedeb fails if there is an existing release. If we're fixing that, we might as well not build if there is no need.
pull/1/head
tommie 2023-03-20 17:33:34 +01:00 committed by GitHub
parent 97b4577504
commit 52c408ce34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 39 additions and 11 deletions

View File

@ -13,19 +13,21 @@ on:
workflow_dispatch:
jobs:
build-deb:
name: Build DEB Packages
check-upstream:
name: Check for a new releases upstream
runs-on: ubuntu-latest
outputs:
innernet_release: ${{ steps.download-release.outputs.innernet_release }}
innernet_release: ${{ steps.check-latest-release.outputs.innernet_release }}
tarball_url: ${{ steps.check-latest-release.outputs.tarball_url }}
new_release_exists: ${{ steps.check-repo-release.outputs.new_release_exists }}
steps:
- name: Install Distro Dependencies
run: sudo env DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends --yes dpkg-dev jq liblzma-dev
run: sudo env DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends --yes jq liblzma-dev reprepro
- name: Download Latest Release
id: download-release
- name: Check Latest Release
id: check-latest-release
run: |
wget -O- \
-H'Accept: application/json' \
@ -34,10 +36,35 @@ jobs:
| (
read release tarball_url
echo "innernet_release=$release" >>"$GITHUB_OUTPUT"
wget -O- "$tarball_url" | tar xz
echo "tarball_url=$tarball_url" >>"$GITHUB_OUTPUT"
)
- name: Check Repo Release
id: check-repo-release
run: |
indexed=$(reprepro --list-format '${version}\n' listmatched unstable innernet)
if [ "x$indexed" = "x${{ steps.check-latest-release.outputs.innernet_release }}" ]; then
echo "new_release_exists=false" >>"$GITHUB_OUTPUT"
else
echo "new_release_exists=true" >>"$GITHUB_OUTPUT"
fi
build-deb:
name: Build DEB Packages
runs-on: ubuntu-latest
needs: [check-upstream]
if: ${{ needs.check-upstream.outputs.new_release_exists == 'true' }}
steps:
- name: Install Distro Dependencies
run: sudo env DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends --yes dpkg-dev liblzma-dev
- name: Download Latest Release
id: download-release
run: |
wget -O- "${{ needs.check-upstream.outputs.tarball_url }}" | tar xz
mv tonarino-innernet-*/* .
rm -fr tonarino-innernet-*
)
- name: Install Rust
uses: actions-rs/toolchain@v1
@ -73,7 +100,8 @@ jobs:
release:
runs-on: ubuntu-latest
needs: [build-deb]
needs: [check-upstream, build-deb]
if: ${{ needs.check-upstream.outputs.new_release_exists == 'true' }}
steps:
- name: Install Distro Dependencies
@ -124,7 +152,7 @@ jobs:
git \
-c 'user.email=41898282+github-actions[bot]@users.noreply.github.com' \
-c 'user.name=github-actions[bot]' \
commit -m "Included release tonarino/innernet@${{ needs.build-deb.outputs.innernet_release }}."
commit -m "Included release tonarino/innernet@${{ needs.check-upstream.outputs.innernet_release }}."
else
echo 'No updates to commit.'
fi