-
-
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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Gradle Wrapper Verification
uses: gradle/wrapper-validation-action@55e685c48d84285a5b0418cd094606e199cca3b6 # v4.1.0
- 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@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Setup JDK
uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4.5.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@c15634bb25b7284dc084f38dff4e838048b7feaf # v1.22
with:
arguments: assemble --info -Pprod
- name: Sonar
uses: burrunan/gradle-cache-action@c15634bb25b7284dc084f38dff4e838048b7feaf # v1.22
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@c15634bb25b7284dc084f38dff4e838048b7feaf # v1.22
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 }}"