Skip to content

CD Check NLnet Labs Unbound Release #2

CD Check NLnet Labs Unbound Release

CD Check NLnet Labs Unbound Release #2

name: CD Check NLnet Labs Unbound Release
on:
schedule:
- cron: '0 19 * * mon-fri'
jobs:
unbound-update:
runs-on: ubuntu-latest
steps:
- name: Get versions
id: GET_VERSIONS
run: |
echo UNBOUND_VERSION="$(curl -s https://api.github.com/repos/NLnetLabs/unbound/releases | jq '.[0] | .name' -r | grep -Eo '([0-9]+)(\.?[0-9]+)*' | head -1)" >> $GITHUB_OUTPUT
echo UNBOUND_DOCKER_VERSION="$(curl -s https://api.github.com/repos/madnuttah/unbound-docker/releases | jq '.[0] | .name' -r | grep -Eo '([0-9]+)(\.?[0-9]+)*' | head -1)" >> $GITHUB_OUTPUT
echo UNBOUND_DOCKER_IMAGE_VERSION="$(curl -s https://api.github.com/repos/madnuttah/unbound-docker/releases | jq '.[0] | .name' -r)" >> $GITHUB_OUTPUT
- name: Is update available
id: IS_UPDATE_AVAILABLE
run: |
if [[ "${{ steps.GET_VERSIONS.outputs.UNBOUND_VERSION }}" == "${{ steps.GET_VERSIONS.outputs.UNBOUND_DOCKER_VERSION }}" ]]; then
echo "No update found"
exit 1
else
echo "Update found"
echo IMAGE_BUILD_DATE="$(date -u)" >> $GITHUB_OUTPUT
echo UNBOUND_SHA256="$(curl -s https://nlnetlabs.nl/downloads/unbound/unbound-"${{ steps.GET_VERSIONS.outputs.UNBOUND_VERSION }}".tar.gz.sha256)" 2>/dev/null >> $GITHUB_OUTPUT
fi
- name: Checkout source
uses: actions/checkout@v4
- name: Push buildvars to repository
run: |
UNBOUND_VERSION=${{ steps.GET_VERSIONS.outputs.UNBOUND_VERSION }}
echo UNBOUND_VERSION=$UNBOUND_VERSION > buildvars
echo UNBOUND_DOCKER_IMAGE_VERSION="${UNBOUND_VERSION}-0" >> buildvars
echo UNBOUND_SHA256=${{ steps.IS_UPDATE_AVAILABLE.outputs.UNBOUND_SHA256 }} >> buildvars
echo IMAGE_BUILD_DATE=${{ steps.IS_UPDATE_AVAILABLE.outputs.IMAGE_BUILD_DATE }} >> buildvars
git config --global user.name "Continuous Delivery"
git config --global user.email "[email protected]"
git add buildvars
git commit buildvars -m "CD Updated buildvars"
git push origin main
exit 0