Skip to content

add -Pversion

add -Pversion #34

Workflow file for this run

# SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org>
#
# SPDX-License-Identifier: MPL-2.0
name: Java CI with Gradle for library
on:
push:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-and-test:
name: Build & Test
runs-on: ubuntu-latest
outputs:
build_tag: ${{ steps.create_tag.outputs.build_tag }}
environment:
name: ci
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # 7.0.1
with:
fetch-depth: 1
persist-credentials: false
- name: Setup runtime
uses: ./.github/actions/setup-runtime
- name: Cache Gradle
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 #v6.1.0
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/settings.gradle*') }}
- name: Optimize Gradle
shell: bash
run: |
mkdir -p ~/.gradle
echo "org.gradle.caching=true" >> ~/.gradle/gradle.properties
echo "org.gradle.configuration-cache=true" >> ~/.gradle/gradle.properties
- name: Build & Run Tests
run: ./gradlew build --configuration-cache
reuse-compliance:
name: REUSE Compliance
uses: ./.github/workflows/reuse-compliance.yml
publish:
name: Publish to maven central
needs: [build-and-test]
# if: always() && github.ref_type == 'tag'
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # 7.0.1
with:
fetch-depth: 1
persist-credentials: false
- name: Setup runtime
uses: ./.github/actions/setup-runtime
- name: Cache Gradle
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 #v6.1.0
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/settings.gradle*') }}
- name: Optimize Gradle
shell: bash
run: |
mkdir -p ~/.gradle
echo "org.gradle.caching=true" >> ~/.gradle/gradle.properties
echo "org.gradle.configuration-cache=true" >> ~/.gradle/gradle.properties
- name: Gradle Release Build
env:
JRELEASER_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }}
JRELEASER_GPG_SECRET_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
SANITIZED_TAG: ${{ github.ref_name }}
JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.MAVEN_USERNAME }}
JRELEASER_MAVENCENTRAL_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
JRELEASER_NEXUS2_USERNAME: ${{ secrets.TEMP_MAVEN_USER }}
JRELEASER_NEXUS2_PASSWORD: ${{ secrets.TEMP_MAVEN_PASSWORD }}
run: |
echo "Performing release Gradle publish for tag: $SANITIZED_TAG"
./gradlew clean build publish -Pversion=0.1-SNAPSHOT
find build/staging-deploy -type f
./gradlew jreleaserDeploy --dryrun -Pversion=0.1-SNAPSHOT