Skip to content

cicd: Add output cache-key #TASK-7809 #1

cicd: Add output cache-key #TASK-7809

cicd: Add output cache-key #TASK-7809 #1

name: Reusable workflow to build Java application

Check failure on line 1 in .github/workflows/build-java-app-workflow.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/build-java-app-workflow.yml

Invalid workflow file

(Line: 82, Col: 1): Unexpected value 'outputs'
on:
workflow_call:
inputs:
maven_opts:
type: string
required: false
build_folder:
type: string
required: false
default: "build-folder"
upload-artifact:
type: boolean
required: false
default: true
needs_hadoop_preparation:
type: boolean
required: false
default: false
hadoop_flavour:
type: string
required: false
default: ""
outputs:
version:
description: "Project version"
value: ${{ jobs.build-workflow.outputs.version }}
jobs:
build-workflow:
name: Build Java app
runs-on: ${{ vars.UBUNTU_VERSION }}
outputs:
version: ${{ steps.get_project_version.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: '10'
- name: Set up JDK 8
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '8'
cache: 'maven'
- name: Cache local Maven repository
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ inputs.hadoop_flavour || vars.HADOOP_FLAVOUR }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-maven-${{ inputs.hadoop_flavour || vars.HADOOP_FLAVOUR }}-
- name: Install dependencies branches
run: |
if [ -f "./.github/workflows/scripts/get_same_branch.sh" ]; then
chmod +x ./.github/workflows/scripts/get_same_branch.sh
./.github/workflows/scripts/get_same_branch.sh ${{ github.ref_name }}
fi
- name: Prepare Hadoop profile
if: ${{ inputs.needs_hadoop_preparation == true }}
run: |
chmod +x ./.github/workflows/scripts/prepare_hadoop.sh
./.github/workflows/scripts/prepare_hadoop.sh --hadoop-flavour "${{ inputs.hadoop_flavour || vars.HADOOP_FLAVOUR }}"
env:
THIRDPARTY_READ_TOKEN: ${{ secrets.THIRDPARTY_READ_TOKEN }}
- name: Maven Build (skip tests)
run: mvn -T 2 clean install -DskipTests ${{ inputs.maven_opts }} --no-transfer-progress
- uses: actions/upload-artifact@v4
if: ${{ inputs.upload-artifact == true }}
with:
name: ${{ inputs.build_folder }}
path: build
- id: get_project_version
name: Get project version
run: |
echo "version=`mvn help:evaluate -q -Dexpression=project.version -DforceStdout`" >> $GITHUB_OUTPUT
- name: test-version-from-check
run: echo "Project version is " ${{ steps.get_project_version.outputs.version }}
outputs:
cache-key:
description: "The key of the maven cache created"
value: ${{ jobs.build-workflow.steps.cache-local-maven-repository.outputs.cache-hit-key }}