PTU5KAS/.github/workflows/master.yml
Jan Kiszka c92d845639 ci: Push directly from build step
Refactor the workflows so that we can use build-push-action also for
publishing. This is a precondition for switching to buildx, needed for
multi-arch images.

The trick needed for this is using an environment variable to control
whether we should push when building the master branch, initializing it
according to the tag status.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2021-01-03 18:39:12 +01:00

42 lines
1.2 KiB
YAML

name: master
on:
push:
branches:
- master
jobs:
deploy_containers:
name: Build and deploy container images
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Identify release build
run: |
# The release workflow will push :latest for tagged revisions
if git describe --exact-match --tags --match '*.*'; then
echo "PUSH_MASTER=false" >> $GITHUB_ENV
else
echo "PUSH_MASTER=true" >> $GITHUB_ENV
fi
- name: Login to ghcr.io
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ secrets.PACKAGE_DEPLOY_USER }}
password: ${{ secrets.PACKAGE_DEPLOY_TOKEN }}
- name: Build kas image
uses: docker/build-push-action@v2
with:
push: ${{ env.PUSH_MASTER }}
tags: ghcr.io/siemens/kas/kas
- name: Build kas-isar image
uses: docker/build-push-action@v2
with:
file: Dockerfile.isar
push: ${{ env.PUSH_MASTER }}
tags: ghcr.io/siemens/kas/kas-isar