From 897095c9cbcadf4c20cc766a995e027b157a8f51 Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Thu, 19 Aug 2021 12:24:37 +0100 Subject: [PATCH] add docker build action --- .github/workflows/docker.yml | 73 ++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 00000000..2732bfdd --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,73 @@ +name: Netdisco Docker Images +on: + workflow_dispatch: + inputs: + debug_enabled: + description: 'Run debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)' + required: false + default: false +# success_irc_squawk: +# description: 'Squawk to IRC on success' +# required: false +# default: false + push: + tags: + - '2.[0-9][0-9][0-9][0-9][0-9][0-9]' +jobs: + build_docker_images: + name: Build Docker Images + runs-on: ubuntu-latest + defaults: + run: + working-directory: /github/workspace/netdisco-docker/netdisco-docker + steps: + - name: Get the Tag + id: get_refs + run: | + echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV + echo "IMAGE_ROOT=netdisco:${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV + - name: Check out latest code + uses: actions/checkout@v1 + with: + repo: 'netdisco/netdisco-docker' + + - name: Build netdisco-postgresql + id: build_netdisco_postgresql + run: | + cd netdisco-postgresql + docker build -t ${IMAGE_ROOT}-postgresql \ + --build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \ + --build-arg TAG=${TAG} \ + --build-arg COMMITTISH=${TAG} . + + - name: Retag all images + run: | + for image in postgresql; do + docker tag ${IMAGE_ROOT}-$image netdisco/${IMAGE_ROOT}-$image + docker tag ${IMAGE_ROOT}-$image netdisco/netdisco:latest-$image + done + +# - name: IRC upload failure notification +# uses: Gottox/irc-message-action@v2 +# if: (! github.event.inputs.debug_enabled) && startsWith(github.ref, 'refs/tags/') +# with: +# channel: '#netdisco' +# nickname: github-actions +# message: |- +# 🤖 Failed to upload Netdisco release ${{ steps.get_refs.outputs.RELEASE_TAG }} to CPAN! 😭 +# 👀 https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} +# - name: IRC upload success notification +# uses: Gottox/irc-message-action@v2 +# if: (! github.event.inputs.debug_enabled) && startsWith(github.ref, 'refs/tags/') +# with: +# channel: '#netdisco' +# nickname: github-actions +# message: |- +# 🤖 Uploaded Netdisco release ${{ steps.get_refs.outputs.RELEASE_TAG }} to CPAN 🎉 + + - name: Setup tmate session + uses: mxschmitt/action-tmate@v3 + if: always() && github.event.inputs.debug_enabled && (github.event_name == 'workflow_dispatch') + with: + sudo: true +