Skip to content

Commit

Permalink
Merge pull request #203 from nmaas-platform/202-add-ci-action-build-a…
Browse files Browse the repository at this point in the history
…-docker-image-with-release-tag

202 add ci action build a docker image with release tag
  • Loading branch information
llopat authored Mar 12, 2024
2 parents 2c2d3be + c0bdf32 commit 62c4806
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
19 changes: 17 additions & 2 deletions .github/workflows/02-build-docker-image.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,28 @@
name: Build docker image with tag latest
name: Build docker image with appropriate tag

on:
push:
branches:
- develop
release:
types: [released]

jobs:
build_docker_image:
runs-on: ubuntu-22.04
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
uses: actions/checkout@v4

Expand All @@ -26,6 +40,7 @@ jobs:
- name: Build image and push to Artifactory
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: |
${{ secrets.DOCKER_REPOSITORY_LOCAL }}:latest
${{ secrets.DOCKER_REPOSITORY_LOCAL }}:${{ env.DOCKER_TAG }}
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
id "org.sonarqube" version "3.2.0"
}

version = '1.6.0-SNAPSHOT'
version = '1.6.0'

task buildGUI(type: Exec) {
println 'Building using Angular CLI'
Expand Down

0 comments on commit 62c4806

Please sign in to comment.