Skip to content

Merge pull request #98 from k-groshev/dependabot/gradle/com.google.gu… #231

Merge pull request #98 from k-groshev/dependabot/gradle/com.google.gu…

Merge pull request #98 from k-groshev/dependabot/gradle/com.google.gu… #231

Workflow file for this run

# This workflow will build a Java project with Gradle
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
name: Java CI with Gradle
on:
push:
branches: [ main ]
tags:
- '*'
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build
- name: Get last release version
id: vars
run: echo ::set-output name=tag::$(echo ${GITHUB_REF:10})
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
if: startsWith(github.ref, 'refs/tags/')
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push docker image
if: startsWith(github.ref, 'refs/tags/')
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/quotes-service:${{steps.vars.outputs.tag}}, ${{ secrets.DOCKERHUB_USERNAME }}/quotes-service:latest
add_git_labels: true