-
-
Notifications
You must be signed in to change notification settings - Fork 15
82 lines (65 loc) · 2.74 KB
/
build.yaml
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: Build
on: push
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
with:
fetch-depth: 0
- name: Gradle Wrapper Verification
uses: gradle/wrapper-validation-action@55e685c48d84285a5b0418cd094606e199cca3b6 # v1.0.5
- name: Set up env
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
# Build number is increased by 1000 due to legacy reasons from previous CI systems
run: |
echo $GITHUB_RUN_NUMBER
BUILD_NUMBER=$((1000 + $GITHUB_RUN_NUMBER))
echo $BUILD_NUMBER
echo "BUILD_NUMBER=$BUILD_NUMBER" >> "$GITHUB_ENV"
IMAGE_BASE=${{ env.DOCKER_USERNAME }}/wolfia
IMAGE_TAG=$(echo $GITHUB_REF | sed -e 's+refs/heads/++g' | sed -e 's+/+_+g')
echo $IMAGE_TAG
echo "BRANCH_TAG=$IMAGE_BASE:$IMAGE_TAG" >> "$GITHUB_ENV"
GIT_HASH=$(git rev-parse HEAD)
echo "Full git hash: $GIT_HASH"
GIT_HASH_SHORT=$(echo "$GIT_HASH" | sed 's/\(.\{8\}\).*/\1/')
echo "Git hash version tag: $GIT_HASH_SHORT"
echo "GIT_HASH_TAG=$IMAGE_BASE:$GIT_HASH_SHORT" >> "$GITHUB_ENV"
- name: Login to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Setup JDK
uses: actions/setup-java@1df8dbefe2a8cbc99770194893dd902763bee34b # v3.9.0
with:
distribution: "temurin"
java-version: 21
cache: "gradle"
- name: Print JDK info
run: java -Xmx32m --version
- name: Gradle Assemble
uses: burrunan/gradle-cache-action@f9ec73cf67dd8ed9a057978212c988945b2f0405 # v1.15
with:
arguments: assemble --info -Pprod
- name: Sonar
uses: burrunan/gradle-cache-action@f9ec73cf67dd8ed9a057978212c988945b2f0405 # v1.15
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
arguments: check sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=wolfiabot -Dsonar.login=${{ env.SONAR_TOKEN }}
- name: Gradle BootJar
uses: burrunan/gradle-cache-action@f9ec73cf67dd8ed9a057978212c988945b2f0405 # v1.15
with:
arguments: bootJar --info -Pprod
- name: Docker Build
run: docker build -t "${{ env.BRANCH_TAG }}" -t "${{ env.GIT_HASH_TAG }}" -f docker/Dockerfile .
- name: Docker Push
run: |
docker push "${{ env.BRANCH_TAG }}"
docker push "${{ env.GIT_HASH_TAG }}"