From: romeroalx Date: Tue, 14 May 2024 15:45:08 +0000 (+0200) Subject: gh actions: add WF for building and pushing images when a new tag is created X-Git-Tag: rec-5.1.0-beta1~42^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c835eb49bba29ac63c1afe7888d8f007ddd10540;p=thirdparty%2Fpdns.git gh actions: add WF for building and pushing images when a new tag is created --- diff --git a/.github/workflows/build-docker-images-tags.yml b/.github/workflows/build-docker-images-tags.yml new file mode 100644 index 0000000000..07074bd574 --- /dev/null +++ b/.github/workflows/build-docker-images-tags.yml @@ -0,0 +1,91 @@ +--- +name: Build images for tags + +on: + push: + tags: + - 'auth-*' + - 'dnsdist-*' + - 'rec-*' + +permissions: + actions: read + contents: read + +jobs: + prepare: + runs-on: ubuntu-22.04 + outputs: + image-name-suffix: ${{ steps.get-image-version.outputs.version }} + image-tag: ${{ steps.get-image-tag.outputs.tag }} + image-description-suffix: ${{ steps.get-image-description.outputs.description }} + steps: + - run: echo "version=$(echo '${{ github.ref_name }}' | cut -d '-' -f 2 | awk -F'.' '{print $1$2}')" >> $GITHUB_OUTPUT + id: get-image-version + - run: echo "tag=$(echo '${{ github.ref_name }}' | cut -d '-' -f 2-)" >> $GITHUB_OUTPUT + id: get-image-tag + - run: echo "description=$(echo '${{ github.ref_name }}' | cut -d '-' -f 2- | awk -F'.' '{print "v"$1"."$2".x"}')" >> $GITHUB_OUTPUT + id: get-image-description + + call-build-image-auth: + uses: PowerDNS/pdns/.github/workflows/build-docker-images.yml@master + if: startsWith(github.ref_name, 'auth') + needs: prepare + with: + product: auth + ref: ${{ github.ref_name }} + image-name: pdns-auth-${{ needs.prepare.outputs.image-name-suffix }} + image-tags: |- + latest + ${{ needs.prepare.outputs.image-tag }} + image-description: 'PowerDNS Authoritative Server ${{ needs.prepare.outputs.image-description-suffix }}' + platforms: linux/amd64,linux/arm64/v8 + build-args: |- + DOCKER_FAKE_RELEASE=YES + push: true + secrets: + DOCKERHUB_ORGANIZATION_NAME: ${{ secrets.DOCKERHUB_ORGANIZATION_NAME }} + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} + + call-build-image-recursor: + uses: PowerDNS/pdns/.github/workflows/build-docker-images.yml@master + if: startsWith(github.ref_name, 'rec') + needs: prepare + with: + product: recursor + ref: ${{ github.ref_name }} + image-name: pdns-recursor-${{ needs.prepare.outputs.image-name-suffix }} + image-tags: |- + latest + ${{ needs.prepare.outputs.image-tag }} + image-description: 'PowerDNS Recursor ${{ needs.prepare.outputs.image-description-suffix }}' + platforms: linux/amd64,linux/arm64/v8 + build-args: |- + DOCKER_FAKE_RELEASE=YES + push: true + secrets: + DOCKERHUB_ORGANIZATION_NAME: ${{ secrets.DOCKERHUB_ORGANIZATION_NAME }} + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} + + call-build-image-dnsdist: + uses: PowerDNS/pdns/.github/workflows/build-docker-images.yml@master + if: startsWith(github.ref_name, 'dnsdist') + needs: prepare + with: + product: dnsdist + ref: ${{ github.ref_name }} + image-name: dnsdist-${{ needs.prepare.outputs.image-name-suffix }} + image-tags: |- + latest + ${{ needs.prepare.outputs.image-tag }} + image-description: 'PowerDNS DNSdist ${{ needs.prepare.outputs.image-description-suffix }}' + platforms: linux/amd64,linux/arm64/v8 + build-args: |- + DOCKER_FAKE_RELEASE=YES + push: true + secrets: + DOCKERHUB_ORGANIZATION_NAME: ${{ secrets.DOCKERHUB_ORGANIZATION_NAME }} + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}