diff --git a/.github/workflows/update-unbound.yml b/.github/workflows/update-unbound.yml new file mode 100644 index 0000000..b7df607 --- /dev/null +++ b/.github/workflows/update-unbound.yml @@ -0,0 +1,51 @@ +name: Update Unbound Dockerfile + +on: + schedule: + - cron: '0 0 * * *' # Run every day at midnight + workflow_dispatch: # Allows manual triggering + +jobs: + update: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Get latest Unbound version + id: get_version + run: | + URL="https://nlnetlabs.nl/downloads/unbound/" + VERSION=$(curl -sL $URL | grep -oP 'unbound-\K[\d.]+(?=.tar.gz)' 2>/dev/null | tail -1) + echo "VERSION=${VERSION}" >> $GITHUB_ENV + + - name: Get SHA256 hash + id: get_sha256 + run: | + URL="https://nlnetlabs.nl/downloads/unbound/" + SHA256=$(curl -sL $URL | grep -oP 'unbound-\d+(\.\d+)+\.tar\.gz\.sha256' | tail -1) + SHA256_HASH=$(curl -sL "$URL/$SHA256" | awk '{print $1}') + echo "SHA256_HASH=${SHA256_HASH}" >> $GITHUB_ENV + + - name: Check if Dockerfile needs update + id: check_dockerfile + run: | + CURRENT_VERSION=$(grep -oP 'ARG UNBOUND_VERSION=\K[\d.]+' Dockerfile) + if [ "$CURRENT_VERSION" != "${{ env.VERSION }}" ]; then + echo "Dockerfile needs update" + echo "UPDATE_DOCKERFILE=true" >> $GITHUB_ENV + else + echo "Dockerfile is up to date" + echo "UPDATE_DOCKERFILE=false" >> $GITHUB_ENV + fi + + - name: Create Pull Request + if: steps.check_dockerfile.outputs.UPDATE_DOCKERFILE == 'true' + uses: peter-evans/create-pull-request@v6 + with: + token: ${{ secrets.GITHUB_TOKEN }} + branch: update-unbound-version + commit-message: "chore: Update Unbound version to ${{ env.VERSION }}" + title: "chore: Update Unbound version to ${{ env.VERSION }}" + body: "This pull request updates the Unbound version in the Dockerfile to ${{ env.VERSION }}." \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 3cf4bbc..5fc04eb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,9 +3,9 @@ ARG TAG='latest' FROM debian:bullseye as unbound -ARG UNBOUND_VERSION=1.19.3 -ARG UNBOUND_SHA256=3ae322be7dc2f831603e4b0391435533ad5861c2322e34a76006a9fb65eb56b9 -ARG UNBOUND_DOWNLOAD_URL=https://nlnetlabs.nl/downloads/unbound/unbound-1.19.3.tar.gz +ARG UNBOUND_VERSION=1.20.0 +ARG UNBOUND_SHA256=56b4ceed33639522000fd96775576ddf8782bb3617610715d7f1e777c5ec1dbf +ARG UNBOUND_DOWNLOAD_URL=https://nlnetlabs.nl/downloads/unbound/unbound-1.20.0.tar.gz WORKDIR /tmp/src