Merge remote-tracking branch 'origin/main' #9
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: CI-CD | |
on: | |
push: | |
branches: ["main"] | |
jobs: | |
CI: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Chechout code | |
uses: actions/checkout@v4.1.1 | |
- name: Setup Java | |
uses: actions/setup-java@v4.0.0 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- name: Get short commit hash | |
id: commit_hash | |
run: echo "::set-output name=hash::$(git rev-parse --short HEAD)" | |
- name: Build project | |
run: mvn clean install -DskipTests | |
- name: Login to Docker Hub | |
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d | |
with: | |
username: ${{secrets.DOCKER_USER}} | |
password: ${{secrets.DOCKER_PWD}} | |
- name: Build Docker image version tag | |
run: docker build -t ${{ secrets.DOCKER_USER }}/astfx-accserv:v1.${{ github.run_number }}.${{ steps.commit_hash.outputs.hash }} . | |
- name: Build Docker image latest tag | |
run: docker build -t ${{ secrets.DOCKER_USER }}/astfx-accserv:latest . | |
- name: Push image Docker with version tag | |
run: docker push ${{ secrets.DOCKER_USER }}/astfx-accserv:v1.${{ github.run_number }}.${{ steps.commit_hash.outputs.hash }} | |
- name: Push image Docker with latest tag | |
run: docker push ${{ secrets.DOCKER_USER }}/astfx-accserv:latest |