Skip to content

Create release (draft) #185

Create release (draft)

Create release (draft) #185

name: Create release (draft)
on:
workflow_dispatch:
push:
branches:
- master
- main
- release/*
paths:
- 'pom*.xml'
jobs:
get_versions:
name: Get version numbers from pom-files
runs-on: ubuntu-latest
outputs:
version_8: ${{ steps.java-8-fix.outputs.version }}
version: ${{ steps.java.outputs.version }}
steps:
- name: Check out neqsim java project
uses: actions/checkout@v4
- name: Get version number for pomJava8.xml
id: java-8
uses: JActions/[email protected]
with:
pom: ./pomJava8.xml
- name: Get version number for pom.xml
id: java
uses: JActions/[email protected]
with:
pom: ./pom.xml
- name: Fix java 8 version number
id: java-8-fix
run: echo "version=$(echo ${{ steps.java-8.outputs.version }} | cut -f 1 -d "-")" >> $GITHUB_OUTPUT
compile_java_8:
name: Build Neqsim ${{ needs.get_versions.outputs.version_8 }} with java 8
needs: get_versions
if: ${{ needs.get_versions.outputs.version_8 == needs.get_versions.outputs.version }}
runs-on: ubuntu-latest
steps:
- name: Check out neqsim java project
uses: actions/checkout@v4
- name: Set up JDK 8 environment
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '8'
cache: 'maven'
- name: Build java 8 version of Neqsim ${{ needs.get_versions.outputs.version_8 }} with Maven
run: mvn -B package --file pomJava8.xml
- name: Copy jar file to staging
run: mkdir staging && cp target/neqsim*Java8.jar staging
- uses: actions/upload-artifact@v3
with:
name: jarfiles-java8
path: staging
compile_java_11:
name: Build Neqsim ${{ needs.get_versions.outputs.version }} with java 11
needs: get_versions
if: ${{ needs.get_versions.outputs.version_8 == needs.get_versions.outputs.version }}
runs-on: ubuntu-latest
steps:
- name: Check out neqsim java project
uses: actions/checkout@v4
- name: Set up JDK 11 environment
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
cache: 'maven'
- name: Build java 11 version with Maven
run: mvn -B package --file pom.xml
- name: Copy jar file to staging
run: mkdir staging && cp target/neqsim*.jar staging
- uses: actions/upload-artifact@v3
with:
name: jarfiles-java11
path: staging
compile_java_21:
name: Build Neqsim ${{ needs.get_versions.outputs.version }} with java 21
needs: get_versions
if: ${{ needs.get_versions.outputs.version_8 == needs.get_versions.outputs.version }}
runs-on: ubuntu-latest
steps:
- name: Check out neqsim java project
uses: actions/checkout@v4
- name: Set up JDK 21 environment
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
cache: 'maven'
- name: Build java 21 version with Maven
run: mvn -B package --file pomJava21.xml
- name: Rename files
run: cd target && find . -type f -name "neqsim-*.jar" -exec sh -c 'mv -f $0 ${0%.jar}-Java21.jar' {} \; && cd ..
- name: Copy jar file to staging
run: mkdir staging && cp target/neqsim*Java21.jar staging
- uses: actions/upload-artifact@v3
with:
name: jarfiles-java21
path: staging
create_release:
name: Create release v${{ needs.get_versions.outputs.version_8 }}
runs-on: ubuntu-latest
needs: [get_versions, compile_java_8, compile_java_11, compile_java_21]
steps:
- name: Download java 8 jar files
uses: actions/[email protected]
with:
name: jarfiles-java8
- name: Download java 11 jar files
uses: actions/[email protected]
with:
name: jarfiles-java11
- name: Download java 21 jar files
uses: actions/[email protected]
with:
name: jarfiles-java21
- name: Create release v${{ needs.get_versions.outputs.version_8 }}
uses: ncipollo/[email protected]
with:
name: NeqSim ${{ needs.get_versions.outputs.version_8 }}
tag: v${{ needs.get_versions.outputs.version_8 }}
draft: true
generateReleaseNotes: true
skipIfReleaseExists: true
artifacts: "*.jar"
artifactContentType: application/java-archive