-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (33 loc) · 1.3 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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-discserv:v1.${{ github.run_number }}.${{ steps.commit_hash.outputs.hash }} .
- name: Build Docker image latest tag
run: docker build -t ${{ secrets.DOCKER_USER }}/astfx-discserv:latest .
- name: Push image Docker with version tag
run: docker push ${{ secrets.DOCKER_USER }}/astfx-discserv:v1.${{ github.run_number }}.${{ steps.commit_hash.outputs.hash }}
- name: Push image Docker with latest tag
run: docker push ${{ secrets.DOCKER_USER }}/astfx-discserv:latest