Files
netdisco/.github/workflows/docker.yml
Oliver Gorwits 34eb8f7dbf fix indent
2021-08-19 13:59:29 +01:00

123 lines
4.5 KiB
YAML

name: Build 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: /home/runner/work/netdisco/netdisco-docker
steps:
- name: Check out latest code
uses: actions/checkout@v1
with:
repository: 'netdisco/netdisco-docker'
ref: 'master'
- name: Get the Tag
id: get_refs
run: |
echo "TAG=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
echo "IMAGE_ROOT=netdisco:${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
- name: 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} .
docker tag ${IMAGE_ROOT}-postgresql netdisco/${IMAGE_ROOT}-postgresql
- name: Build netdisco-base
run: |
cd netdisco-base
docker build -t ${IMAGE_ROOT}-base \
--build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
--build-arg TAG=${TAG} \
--build-arg COMMITTISH=${TAG} .
docker tag ${IMAGE_ROOT}-base netdisco/${IMAGE_ROOT}-base
- name: Build netdisco-backend
run: |
cd netdisco-backend
docker build -t ${IMAGE_ROOT}-backend \
--build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
--build-arg TAG=${TAG} \
--build-arg COMMITTISH=${TAG} .
docker tag ${IMAGE_ROOT}-backend netdisco/${IMAGE_ROOT}-backend
- name: Build netdisco-web
run: |
cd netdisco-web
docker build -t ${IMAGE_ROOT}-web \
--build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
--build-arg TAG=${TAG} \
--build-arg COMMITTISH=${TAG} .
docker tag ${IMAGE_ROOT}-web netdisco/${IMAGE_ROOT}-web
- name: Build netdisco-do
run: |
cd netdisco-do
docker build -t ${IMAGE_ROOT}-do \
--build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
--build-arg TAG=${TAG} \
--build-arg COMMITTISH=${TAG} .
docker tag ${IMAGE_ROOT}-do netdisco/${IMAGE_ROOT}-do
- name: Tag all images latest
run: |
for image in postgresql backend web do; do
docker tag ${IMAGE_ROOT}-$image netdisco/netdisco:latest-$image
done
- name: Upload all images
if: (! github.event.inputs.debug_enabled) && startsWith(github.ref, 'refs/tags/')
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
for image in postgresql backend web do; do
docker push netdisco/${IMAGE_ROOT}-$image
docker push 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