From 76f45225d9149cc8533da190f9c675e52849abfc Mon Sep 17 00:00:00 2001 From: Robert Resch Date: Mon, 5 Jul 2021 12:39:17 +0200 Subject: [PATCH] use branch name as tag name --- .github/workflows/docker-images.yml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docker-images.yml b/.github/workflows/docker-images.yml index d6a2ae8..6dc2cc7 100644 --- a/.github/workflows/docker-images.yml +++ b/.github/workflows/docker-images.yml @@ -2,9 +2,6 @@ name: Build docker images on: push: - branches: - - master - - next jobs: build: @@ -13,6 +10,19 @@ jobs: - name: checkout code uses: actions/checkout@v2 + - name: Get tag name + shell: bash + run: | + branch=$(echo ${GITHUB_REF#refs/heads/}); + if [ -z $BRANCH ]; then + exit 1; + elif [ $BRANCH == "master" ]; then + branch=latest; + fi + + echo "##[set-output name=tag;]$(echo $branch)" + id: tag_name + # https://github.com/docker/setup-qemu-action - name: Set up QEMU uses: docker/setup-qemu-action@v1 @@ -28,5 +38,5 @@ jobs: - name: build the image run: | docker buildx build --push \ - --tag edenhaus/bumper:latest \ + --tag edenhaus/bumper:${{ steps.tag_name.outputs.tag }} \ --platform linux/amd64,linux/arm/v7,linux/arm64 . \ No newline at end of file