Merge pull request #225 from nmaas-platform/210-the-access-modal-shou… #52
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Artifactory | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ secrets.DOCKER_REPOSITORY }} | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build image and push to Artifactory | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
push: true | |
tags: | | |
${{ secrets.DOCKER_REPOSITORY_LOCAL }}:${{ env.DOCKER_TAG }} |