From 4228c64a1bb0e11e4e0545be04f62b8b43ca52bc Mon Sep 17 00:00:00 2001 From: "aditya.chandel" <8075870+adityachandelgit@users.noreply.github.com> Date: Tue, 5 Aug 2025 15:47:21 -0600 Subject: [PATCH] feat: notify Discord on new release with drafter info and Docker image links --- .github/workflows/docker-build-publish.yml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker-build-publish.yml b/.github/workflows/docker-build-publish.yml index 637f3c220..25bf6a847 100644 --- a/.github/workflows/docker-build-publish.yml +++ b/.github/workflows/docker-build-publish.yml @@ -157,4 +157,22 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - gh release edit ${{ env.new_tag }} --draft=false \ No newline at end of file + gh release edit ${{ env.new_tag }} --draft=false + + - name: Notify Discord of New Release + if: github.ref == 'refs/heads/master' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }} + run: | + release_json=$(gh release view ${{ env.new_tag }} --json name,body,url) + release_name=$(echo "$release_json" | jq -r '.name') + release_body=$(echo "$release_json" | jq -r '.body') + release_url=$(echo "$release_json" | jq -r '.url') + dockerhub_image="https://hub.docker.com/r/booklore/booklore-app/tags" + ghcr_image="https://github.com/${{ github.repository }}/packages" + content=":tada: **New Release:** [$release_name]($release_url)\n\n$release_body\n\n**Docker Images:**\n- Docker Hub: \`booklore/booklore-app:${{ env.new_tag }}\` ([View]($dockerhub_image))\n- GHCR: \`ghcr.io/${{ github.repository }}/booklore-app:${{ env.new_tag }}\` ([View]($ghcr_image))" + payload="{\"content\": \"$content\"}" + curl -H "Content-Type: application/json" -X POST -d "$payload" $DISCORD_WEBHOOK_URL + +