-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Alertmonitor Docker Image CI | ||
|
||
on: | ||
push: | ||
branches: [ "master" ] | ||
pull_request: | ||
branches: [ "master" ] | ||
|
||
jobs: | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
environment: alertmonitor_environment | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- name: Log in to Docker Hub | ||
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
- name: Read current version | ||
run: echo "TAG=$(cat src/main/webapp/WEB-INF/version.txt)" >> $GITHUB_ENV | ||
- name: Print current version | ||
run: echo "Building version $TAG" | ||
- name: Build the Docker image | ||
run: docker build . --file Dockerfile --tag matjaz99/alertmonitor:$TAG | ||
- name: Push the image | ||
run: docker push matjaz99/alertmonitor:$TAG | ||
- name: Retag to latest | ||
run: if [[ $TAG != *"SNAPSHOT"* ]]; then docker tag matjaz99/alertmonitor:$TAG matjaz99/alertmonitor:latest; fi | ||
- name: Push the latest image | ||
run: if [[ $TAG != *"SNAPSHOT"* ]]; then docker push matjaz99/alertmonitor:latest; fi |