Implement Spring Boot Actuator #93
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }}" |