Skip to content

Check in dev and test run config #108

Check in dev and test run config

Check in dev and test run config #108

Workflow file for this run

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/actions/wrapper-validation@0bdd871935719febd78681f197cd39af5b6e16a6 # v4.2.2
- 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.token=${{ 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 }}"