chore: test ci (#2)

This commit is contained in:
Alexander Chikovany 2023-08-26 21:48:17 -04:00 committed by GitHub
parent 507aa900c3
commit aaac2cc11a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 11 deletions

View file

@ -4,6 +4,9 @@ on:
push:
branches: [ development, release-* ]
env:
IMAGE_NAME: ${{ github.repository }}
jobs:
build_and_publish:
runs-on: ubuntu-latest
@ -54,15 +57,17 @@ jobs:
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ghcr.io/${GITHUB_REPOSITORY}
images: ghcr.io/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
push: true
tags: ghcr.io/${GITHUB_REPOSITORY}:${{ steps.semantic.outputs.release-version }}
tags: ghcr.io/${{ env.IMAGE_NAME }}:${{ steps.semantic.outputs.release-version }}
labels: ${{ steps.meta.outputs.labels }}
build-args:
- VERSION: ${{ steps.semantic.outputs.release-version }}
- name: Publish tag
uses: actions-ecosystem/action-push-tag@v1

View file

@ -4,6 +4,9 @@ on:
pull_request:
branches: [ development, release/** ]
env:
IMAGE_NAME: ${{ github.repository }}
jobs:
java_build:
runs-on: ubuntu-latest
@ -14,7 +17,7 @@ jobs:
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'temirin'
distribution: 'temurin'
- name: Test
run: ./gradlew test
- name: Build
@ -31,4 +34,4 @@ jobs:
with:
context: .
push: false
tags: ghcr.io/${ GITHUB_REPOSITORY }:test
tags: ghcr.io/${{ env.IMAGE_NAME }}:test

View file

@ -1,12 +1,11 @@
ENV WORKDIR /app
ENV PORT 8080
ENV VERSION undefined
FROM eclipse-temurin@sha256:039f727ed86402f37524b5d01a129947e2f061d5856901d07d73a454e689bb13 AS builder
WORKDIR $WORKDIR
ARG VERSION undefined
ENV VERSION=$VERSION
WORKDIR /app
COPY . .
RUN ./gradlew build -x test -Pversion=$VERSION
FROM eclipse-temurin@sha256:e90e0d654765ab3ae33f5c5155daafa4a907d0d738ce98c3be8f402a8edcee2b
WORKDIR $WORKDIR
COPY --from=builder $APP_HOME/build/libs/*jar .
ENV PORT 8080
WORKDIR /app
COPY --from=builder /app/build/libs/*jar .

View file

@ -1,5 +1,8 @@
# Spring PetClinic Sample Application [![Build Status](https://github.com/spring-projects/spring-petclinic/actions/workflows/maven-build.yml/badge.svg)](https://github.com/spring-projects/spring-petclinic/actions/workflows/maven-build.yml)
[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/spring-projects/spring-petclinic) [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://github.com/codespaces/new?hide_repo_select=true&ref=main&repo=7517918)