Skip to content

build(deps): bump org.springframework.boot in /modules/gs-user (#781) #397

build(deps): bump org.springframework.boot in /modules/gs-user (#781)

build(deps): bump org.springframework.boot in /modules/gs-user (#781) #397

Workflow file for this run

# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: CI (gs-user)
on:
push:
branches:
- master
paths:
- "modules/gs-user/**"
- ".github/workflows/gs-user.yml"
pull_request:
types: [ opened, synchronize, reopened ]
paths:
- "modules/gs-user/**"
- ".github/workflows/gs-user.yml"
defaults:
run:
working-directory: ./modules/gs-user
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17
- name: Cache SonarCloud packages
uses: actions/cache@v1
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Gradle packages
uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: Build and test
run: ./gradlew build test sonar -Dsonar.token=${{ secrets.SONAR_TOKEN }}
# - name: SonarCloud Scan
# uses: sonarsource/sonarcloud-github-action@master
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# JAVA_HOME: '' # Avoid 'java: not found' error
# with:
# projectBaseDir: modules/gs-user
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set image tag on pull request
if: github.event_name == 'pull_request'
run: |
echo "image_tag=$(echo ${GITHUB_HEAD_REF})" >> $GITHUB_ENV
- name: Set image tag on master
if: github.ref == 'refs/heads/master'
run:
echo "image_tag=latest" >> $GITHUB_ENV
- name: Print image tag
run:
echo "${{ env.image_tag }}"
- name: Build and push
id: docker_build
uses: docker/build-push-action@v4
with:
push: true
tags: sanek555/gs-user:${{ env.image_tag }}
file: ./modules/gs-user/docker/Dockerfile # Path to the file relatively to the root directory
context: ./modules/gs-user # Directory in which you would run 'docker build' command, . stands for root
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}