Skip to content
This repository has been archived by the owner on Mar 12, 2024. It is now read-only.

Merge pull request #48 from eclipse-tractusx/chore/add-archive-info-o… #31

Merge pull request #48 from eclipse-tractusx/chore/add-archive-info-o…

Merge pull request #48 from eclipse-tractusx/chore/add-archive-info-o… #31

name: Build images and push as GitHub Package
on:
push:
branches: [ develop, main ]
workflow_dispatch:
branches: [ develop, main ]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}_service
jobs:
build-and-push-image:
runs-on: ubuntu-20.04
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- uses: madhead/read-java-properties@latest
id: version
with:
file: gradle.properties
property: version
default: 0.0.1
- name: Set App Version
run: echo "APP_VERSION=${{ steps.version.outputs.value }}" >> $GITHUB_ENV
- name: Set outputs
id: vars
run: |
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Show version
run: echo ${APP_VERSION}.${SHORT_SHA}
- name: Set optional tag suffix
if: github.ref != 'refs/heads/main'
run: echo "TAG_SUFFIX=-${GITHUB_REF##*/}" >> $GITHUB_ENV
- name: Show tag
run: echo tag=latest${{ env.TAG_SUFFIX }}
- name: Login to GitHub Container Registry
if: ${{ !env.ACT }}
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Metadata (tags, labels) for Docker
if: ${{ !env.ACT }}
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17
- name: Build with Gradle
uses: gradle/gradle-build-action@4137be6a8bf7d7133955359dbd952c0ca73b1021
with:
arguments: build
- name: Create dist
uses: gradle/gradle-build-action@4137be6a8bf7d7133955359dbd952c0ca73b1021
with:
arguments: installDist
- name: Veracode Upload And Scan
uses: veracode/[email protected]
continue-on-error: true
with:
appname: 'project-managed-identity-wallets'
createprofile: false
filepath: 'build/install/org.eclipse.tractusx.managedidentitywallets/lib/*' # add filepath for upload
vid: '${{ secrets.ORG_VERACODE_API_ID }}' # reference to API ID, which is set as github org. secret
vkey: '${{ secrets.ORG_VERACODE_API_KEY }}' #reference to API Key in github, which is set as github or. secret
include: 'build/install/org.eclipse.tractusx.managedidentitywallets/lib/org.eclipse.tractusx.managedidentitywallets-*jar'
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest${{ env.TAG_SUFFIX }}, ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.APP_VERSION }}.${{ env.SHORT_SHA }}, ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.APP_VERSION }}${{ env.TAG_SUFFIX }}
labels: ${{ steps.meta.outputs.labels }}