Update main.yml #34
This file contains hidden or 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: workflow of java springboot | |
on: | |
push: | |
branches: | |
- dev | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v2 | |
- name: Set Up JDK 17 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Cache Maven Dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: Get Maven Build Version | |
id: get-version | |
run: | | |
echo "version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout | tail -1)" >> $GITHUB_OUTPUT | |
- name: Build with Maven | |
run: mvn clean package -DskipTests | |
- name: Login to JFrog Artifactory | |
uses: docker/login-action@v2 | |
with: | |
registry: trialktyenb.jfrog.io | |
username: ${{ secrets.JFROG_USERNAME }} | |
password: ${{ secrets.JFROG_TOKEN }} | |
- name: Docker metadata | |
id: docker-meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: "${{ inputs.docker-repository }}/${{ steps.prep.outputs.image }}" | |
labels: | | |
com.uhg.image.askid=${{ inputs.ask-id }} | |
com.uhg.image.branch=${{ github.ref }} | |
com.uhg.image.build=${{ github.run_id }} | |
com.uhg.image.buildnumber=${{ github.run_number }} | |
com.uhg.image.buildurl=${{ github.run_url }} | |
com.uhg.image.repo_id=${{ github.repository_id }} | |
com.uhg.image.workflow_name=${{ github.workflow }} | |
com.uhg.image.workflow_ref=${{ github.workflow_ref }} | |
org.opencontainers.image.source=${{ github.repository }} | |
org.opencontainers.image.revision=${{ github.sha }} | |
org.opencontainers.image.created=${{ github.event.head_commit.timestamp }} | |
org.opencontainers.image.authors=${{ github.event.head_commit.author.name }} | |
org.opencontainers.image.url=${{ github.event.head_commit.url }} | |
org.opencontainers.image.documentation=${{ github.event.head_commit.url }} | |
org.opencontainers.image.vendor=UnitedHealth Group | |
org.opencontainers.image.description=${{ steps.get-description.outputs.repo-description }} | |
tags: ${{ steps.prep.outputs.tag }} | |
- name: Setup Buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
version: ${{ inputs.docker-buildx-version }} | |
- name: Build Docker image | |
run: docker build . --tag trialktyenb.jfrog.io/artifactory/springbootapp:latest | |
- name: Push Docker image | |
run: docker push trialktyenb.jfrog.io/artifactory/springbootapp:latest | |
# - name: Build | |
# uses: docker/build-push-action@v6 | |
# id: build | |
# with: | |
# context: ${{ inputs.docker-context }} | |
# file: ${{ inputs.docker-dockerfile }} | |
# tags: ${{ steps.docker-meta.outputs.tags }} | |
# labels: ${{ steps.docker-meta.outputs.labels }} | |
# build-args: ${{ inputs.docker-build-args }} | |
# target: ${{ inputs.target }} | |
# # platforms: ${{ inputs.docker-platforms }} # Multi-platform not currently supported with load: true | |
# load: true | |
# cache-from: ${{ inputs.docker-image-cache-from }} | |
# cache-to: ${{ inputs.docker-image-cache-to }} | |
# secrets: ${{ inputs.docker-build-secrets }} | |