-
Notifications
You must be signed in to change notification settings - Fork 0
38 lines (38 loc) · 1.77 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
name: Build
on: [push]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- name: Get tag or branch
id: get_tag_or_branch
run: |
if echo $GITHUB_REF | grep -Eq '^refs\/tags\/.*'; then
echo ::set-output name=TAG_OR_BRANCH::${GITHUB_REF#refs/tags/}
else
echo ::set-output name=TAG_OR_BRANCH::${GITHUB_REF#refs/heads/}
fi
- name: Gradle test
if: github.ref != 'refs/heads/main' && ! startsWith(github.ref, 'refs/tags')
env:
GRADLE_CLI_OPTS: "-Dversion=${{steps.get_tag_or_branch.outputs.TAG_OR_BRANCH}} -Dquarkus.container-image.builder=docker"
run: "chmod +x ./gradlew && ./gradlew ${GRADLE_CLI_OPTS} build"
- name: Login to DockerHub
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags')
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker images
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags')
env:
TAG_OR_BRANCH: ${{steps.get_tag_or_branch.outputs.TAG_OR_BRANCH}}
GRADLE_CLI_OPTS: "-Dquarkus.container-image.tag=${{steps.get_tag_or_branch.outputs.TAG_OR_BRANCH}} -Dversion=${{steps.get_tag_or_branch.outputs.TAG_OR_BRANCH}} -Dquarkus.container-image.push=true -Dquarkus.container-image.build=true -Dquarkus.container-image.builder=docker -Dquarkus.container-image.group=faforever"
run: "chmod +x ./gradlew && ./gradlew ${GRADLE_CLI_OPTS} build"