Skip to content

another try

another try #86

Workflow file for this run

name: '[ BUILD ] Build Project (Java/Gradle)'
on:
workflow_dispatch:
inputs:
release_build:
description: 'toggles an release-build, by default false'
type: boolean
default: false
required: false
build_version:
description: 'The version to build and deploy'
type: string
required: true
default: '0-SNAPSHOT'
workflow_call:
inputs:
release_build:
description: 'toggles an release-build, by default false'
type: boolean
default: false
required: false
build_version:
description: 'The version to build and deploy'
type: string
required: true
default: '0-SNAPSHOT'
outputs:
artifact_id:
description: 'The artifact id of the project.'
value: ${{ jobs.Build.outputs.artifact_id }}
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
Validation:
name: "Validation"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: gradle/actions/wrapper-validation@v3
Build:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
outputs:
artifact_id: ${{ steps.ArtifactId.outputs.artifact_id }}
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
# Configure Gradle for optimal use in GiHub Actions, including caching of downloaded dependencies.
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3 # v3.1.0
with:
add-job-summary-as-pr-comment: on-failure
artifact-retention-days: 5
# with:
# dependency-graph: generate-and-submit
- name: Clean
if: inputs.release_build
run: ./gradlew clean
env:
GITHUB_DEPENDENCY_GRAPH_ENABLED: false
- name: Build with Gradle Wrapper
id: Build
run: ./gradlew -Pversion=${BUILD_VERSION} --info build jacocoTestReport
env:
BUILD_VERSION: ${{ inputs.build_version }}
- name: Sign artifacts
if: steps.Build.outcome == 'success'
# if: inputs.release_build
run: |
./gradlew -Pversion=${build_version} \
-PGPG_SIGNING_KEY_PASSWORD="${GPG_SIGNING_KEY_PASSWORD}" \
-PGPG_SIGNING_KEY="${GPG_SIGNING_KEY}" \
-PGPG_KEY_ID="${GPG_KEY_ID}" \
--info signMavenJavaPublication
env:
GPG_SIGNING_KEY_PASSWORD: ${{ secrets.GPG_SIGNING_KEY_PASSWORD }}
GPG_SIGNING_KEY: |
${{ secrets.GPG_SIGNING_KEY }}
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: ~/**/build/libs/*.jar
- name: Artifact Id
id: ArtifactId
run: echo artifact_id=echo ${$(ls build/libs/*${BUILD_VERSION}.jar| xargs -n 1 basename )%-${BUILD_VERSION}.jar} >> $GITHUB_OUTPUT
env:
BUILD_VERSION: ${{ inputs.build_version }}
DependencySubmission:
name: "Dependency Submission"
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
# Generates and submits a dependency graph, enabling Dependabot Alerts for all project dependencies.
# https://github.com/gradle/actions/blob/main/docs/dependency-submission.md
- name: Generate and submit dependency graph
uses: gradle/actions/dependency-submission@v3
env:
# Exclude all dependencies that originate solely in the 'buildSrc' or testapp project
DEPENDENCY_GRAPH_EXCLUDE_PROJECTS: ':buildSrc|:cursorpaging-testapp'
# Exclude dependencies that are only resolved in test classpaths
DEPENDENCY_GRAPH_EXCLUDE_CONFIGURATIONS: '.*[Tt]est(Compile|Runtime)Classpath'
with:
build-scan-publish: true
build-scan-terms-of-use-url: "https://gradle.com/help/legal-terms-of-use"
build-scan-terms-of-use-agree: "yes"