Skip to content

Commit

Permalink
Add s^ringboot native
Browse files Browse the repository at this point in the history
  • Loading branch information
Rakambda committed Dec 23, 2023
1 parent 6a27668 commit a3d8e96
Showing 1 changed file with 75 additions and 0 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/springboot-native-docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: SpringBoot Gradle native Docker publish

on:
workflow_call:
inputs:
java-version:
description: "JDK version to use"
required: true
type: string
docker-image:
description: "Name of the docker image to push"
required: true
type: string
docker-tag:
description: "Tag of the docker image to push, defaults to current branch name"
required: false
type: string
default: ""
runs-on:
description: "Runner to use"
required: false
type: string
default: "ubuntu-latest"
secrets:
docker-repo:
description: "Docker registry to push to"
required: true
docker-username:
description: "Docker username"
required: true
docker-token:
description: "Docker token"
required: true

jobs:
publish:
name: SpringBoot Native Gradle - Publish Docker
runs-on: ["ubuntu-latest", "${{ inputs.runs-on }}"]
concurrency: docker-${{ inputs.docker-tag }}
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Login on registry
uses: docker/login-action@v3.0.0
with:
registry: ${{ secrets.docker-repo }}
username: ${{ secrets.docker-username }}
password: ${{ secrets.docker-token }}
- name: Set up JDK
uses: graalvm/setup-graalvm@v1
with:
version: 'latest'
java-version: ${{ inputs.java-version }}
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
native-image-job-reports: "true"

- name: Calculate image tag
id: image-tag
run: |
if [ -z "${{ inputs.docker-tag }}" ]; then
echo "tag=${GITHUB_REF##*/}" >> "$GITHUB_OUTPUT"
else
echo "tag=${{ inputs.docker-tag }}" >> "$GITHUB_OUTPUT"
fi
- name: Boot build native
uses: gradle/gradle-build-action@v2.8.0
with:
cache-disabled: true
arguments: |
bootBuildImage
--imageName=${{ secrets.docker-repo }}/${{ inputs.docker-image }}:${{ steps.image-tag.outputs.tag }}
- name: Push on registry
run: |
docker push ${{ secrets.docker-repo }}/${{ inputs.docker-image }}:${{ steps.image-tag.outputs.tag }}

0 comments on commit a3d8e96

Please sign in to comment.