Skip to content
Snippets Groups Projects
Commit 1be991a8 authored by Łukasz Łopatowski's avatar Łukasz Łopatowski
Browse files

Enhanced CI actions to build docker image with appropriate tag

parent 7f602a02
No related branches found
No related tags found
No related merge requests found
name: Build docker image with tag latest name: Build docker image with appropriate tag
on: on:
push: push:
branches: branches:
- develop - develop
release:
types: [released]
jobs: jobs:
build_docker_image: build_docker_image:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
steps: steps:
- name: Determine Docker Tag
id: docker_tag
run: |
GIT_EVENT=${{ github.event_name }}
GIT_BRANCH_NAME=${GITHUB_REF##*/}
if [[ $GIT_EVENT == 'push' && $GIT_BRANCH_NAME == 'develop' ]]; then
echo "DOCKER_TAG=latest" >> $GITHUB_ENV
elif [[ $GIT_EVENT == 'release' ]]; then
GIT_TAG_NAME=${{ github.event.release.tag_name }}
echo "DOCKER_TAG=$(echo $GIT_TAG_NAME | cut -c 2-)" >> $GITHUB_ENV
fi
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
...@@ -29,4 +43,4 @@ jobs: ...@@ -29,4 +43,4 @@ jobs:
context: . context: .
push: true push: true
tags: | tags: |
${{ secrets.DOCKER_REPOSITORY_LOCAL }}:latest ${{ secrets.DOCKER_REPOSITORY_LOCAL }}:${{ env.DOCKER_TAG }}
\ No newline at end of file \ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment