From fe733e49795f5e6d7f30ceb0c9b87e5357f66d6a Mon Sep 17 00:00:00 2001 From: Joly0 <13993216+Joly0@users.noreply.github.com> Date: Sat, 11 May 2024 15:23:10 +0200 Subject: [PATCH 1/7] Create update-unbound.yml Create update-unbound.yml --- .github/workflows/update-unbound.yml | 43 ++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/update-unbound.yml diff --git a/.github/workflows/update-unbound.yml b/.github/workflows/update-unbound.yml new file mode 100644 index 0000000..5df6803 --- /dev/null +++ b/.github/workflows/update-unbound.yml @@ -0,0 +1,43 @@ +name: Update Unbound Dockerfile + +on: + schedule: + - cron: '0 0 * * *' # Run every day at midnight + +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 SHA1 hash + id: get_sha1 + run: | + URL="https://nlnetlabs.nl/downloads/unbound/" + SHA1=$(curl -sL $URL | grep -oP 'unbound-\d+(\.\d+)+\.tar\.gz\.sha1' | tail -1) + SHA1_HASH=$(curl -sL "$URL/$SHA1" | awk '{print $1}') + echo "SHA1_HASH=${SHA1_HASH}" >> $GITHUB_ENV + + - name: Update Dockerfile + run: | + sed -i "s/ARG UNBOUND_VERSION=.*/ARG UNBOUND_VERSION=${VERSION}/g" Dockerfile + sed -i "s/ARG UNBOUND_SHA256=.*/ARG UNBOUND_SHA256=${SHA1_HASH}/g" Dockerfile + sed -i "s|ARG UNBOUND_DOWNLOAD_URL=.*|ARG UNBOUND_DOWNLOAD_URL=https://nlnetlabs.nl/downloads/unbound/unbound-${VERSION}.tar.gz|g" Dockerfile + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v3 + 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 From 1f4d24f034eb4564841803255e0bab0a64f55082 Mon Sep 17 00:00:00 2001 From: Joly0 Date: Sun, 12 May 2024 01:19:55 +0000 Subject: [PATCH 2/7] chore: Update Unbound version to 1.20.0 --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3cf4bbc..9783489 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=e1963919e49a64151bed2475e470042b631950fb +ARG UNBOUND_DOWNLOAD_URL=https://nlnetlabs.nl/downloads/unbound/unbound-1.20.0.tar.gz WORKDIR /tmp/src From 4949ce95b02ca5f0d43cbb294a910ee3c8ce24cf Mon Sep 17 00:00:00 2001 From: Joly0 <13993216+Joly0@users.noreply.github.com> Date: Sun, 12 May 2024 10:32:59 +0200 Subject: [PATCH 3/7] Update update-unbound.yml check if dockerfile needs and update for unbound version, and only continue if needed. Also added ootion to manually run the workflow --- .github/workflows/update-unbound.yml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/update-unbound.yml b/.github/workflows/update-unbound.yml index 5df6803..b1f2573 100644 --- a/.github/workflows/update-unbound.yml +++ b/.github/workflows/update-unbound.yml @@ -3,6 +3,7 @@ name: Update Unbound Dockerfile on: schedule: - cron: '0 0 * * *' # Run every day at midnight + workflow_dispatch: # Allows manual triggering jobs: update: @@ -27,13 +28,20 @@ jobs: SHA1_HASH=$(curl -sL "$URL/$SHA1" | awk '{print $1}') echo "SHA1_HASH=${SHA1_HASH}" >> $GITHUB_ENV - - name: Update Dockerfile + - name: Check if Dockerfile needs update + id: check_dockerfile run: | - sed -i "s/ARG UNBOUND_VERSION=.*/ARG UNBOUND_VERSION=${VERSION}/g" Dockerfile - sed -i "s/ARG UNBOUND_SHA256=.*/ARG UNBOUND_SHA256=${SHA1_HASH}/g" Dockerfile - sed -i "s|ARG UNBOUND_DOWNLOAD_URL=.*|ARG UNBOUND_DOWNLOAD_URL=https://nlnetlabs.nl/downloads/unbound/unbound-${VERSION}.tar.gz|g" Dockerfile + 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@v3 with: token: ${{ secrets.GITHUB_TOKEN }} From cc90a5cfe105f8ed01f30dc7031b6cf9dfbee855 Mon Sep 17 00:00:00 2001 From: Joly0 <13993216+Joly0@users.noreply.github.com> Date: Sun, 12 May 2024 10:52:07 +0200 Subject: [PATCH 4/7] Update update-unbound.yml --- .github/workflows/update-unbound.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/update-unbound.yml b/.github/workflows/update-unbound.yml index b1f2573..afb45da 100644 --- a/.github/workflows/update-unbound.yml +++ b/.github/workflows/update-unbound.yml @@ -20,13 +20,13 @@ jobs: VERSION=$(curl -sL $URL | grep -oP 'unbound-\K[\d.]+(?=.tar.gz)' 2>/dev/null | tail -1) echo "VERSION=${VERSION}" >> $GITHUB_ENV - - name: Get SHA1 hash - id: get_sha1 + - name: Get SHA256 hash + id: get_sha256 run: | URL="https://nlnetlabs.nl/downloads/unbound/" - SHA1=$(curl -sL $URL | grep -oP 'unbound-\d+(\.\d+)+\.tar\.gz\.sha1' | tail -1) - SHA1_HASH=$(curl -sL "$URL/$SHA1" | awk '{print $1}') - echo "SHA1_HASH=${SHA1_HASH}" >> $GITHUB_ENV + SHA256=$(curl -sL $URL | grep -oP 'unbound-\d+(\.\d+)+\.tar\.gz\.sha256' | tail -1) + SHA256_HASH=$(curl -sL "$URL/$SHA1" | awk '{print $1}') + echo "SHA256_HASH=${SHA256_HASH}" >> $GITHUB_ENV - name: Check if Dockerfile needs update id: check_dockerfile From d2ec856bd1316815d44760973aa05a8cf297ea50 Mon Sep 17 00:00:00 2001 From: Joly0 <13993216+Joly0@users.noreply.github.com> Date: Sun, 12 May 2024 10:52:38 +0200 Subject: [PATCH 5/7] Update update-unbound.yml --- .github/workflows/update-unbound.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-unbound.yml b/.github/workflows/update-unbound.yml index afb45da..3f33fa3 100644 --- a/.github/workflows/update-unbound.yml +++ b/.github/workflows/update-unbound.yml @@ -25,7 +25,7 @@ jobs: 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/$SHA1" | awk '{print $1}') + SHA256_HASH=$(curl -sL "$URL/$SHA256" | awk '{print $1}') echo "SHA256_HASH=${SHA256_HASH}" >> $GITHUB_ENV - name: Check if Dockerfile needs update From f3ae6c79dbdc130c5d6e305f6008297bde6ddfbf Mon Sep 17 00:00:00 2001 From: Joly0 <13993216+Joly0@users.noreply.github.com> Date: Sun, 12 May 2024 10:53:58 +0200 Subject: [PATCH 6/7] Update Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 9783489..5fc04eb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ ARG TAG='latest' FROM debian:bullseye as unbound ARG UNBOUND_VERSION=1.20.0 -ARG UNBOUND_SHA256=e1963919e49a64151bed2475e470042b631950fb +ARG UNBOUND_SHA256=56b4ceed33639522000fd96775576ddf8782bb3617610715d7f1e777c5ec1dbf ARG UNBOUND_DOWNLOAD_URL=https://nlnetlabs.nl/downloads/unbound/unbound-1.20.0.tar.gz WORKDIR /tmp/src From d0aaa907b4e58f9bde951b29fbf87f00f0fdd33f Mon Sep 17 00:00:00 2001 From: Joly0 <13993216+Joly0@users.noreply.github.com> Date: Tue, 14 May 2024 14:16:22 +0200 Subject: [PATCH 7/7] Update update-unbound.yml Updated the action for creating the pull request --- .github/workflows/update-unbound.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-unbound.yml b/.github/workflows/update-unbound.yml index 3f33fa3..b7df607 100644 --- a/.github/workflows/update-unbound.yml +++ b/.github/workflows/update-unbound.yml @@ -42,7 +42,7 @@ jobs: - name: Create Pull Request if: steps.check_dockerfile.outputs.UPDATE_DOCKERFILE == 'true' - uses: peter-evans/create-pull-request@v3 + uses: peter-evans/create-pull-request@v6 with: token: ${{ secrets.GITHUB_TOKEN }} branch: update-unbound-version