Skip to content

update h2 database version (#1082) #151

update h2 database version (#1082)

update h2 database version (#1082) #151

name: Create release (draft)
# Workflow is triggered when any pom-file is updated in master-branch
# If both pom-files have the same version number it
# - builds NeqSim-jars both in Java 8 and Java 11
# - creates a new release and uploads the jars as artifacts
# - makes a new branch in neqsimpython and updates the jar-files used there.
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/maven-version@v1.2.0
with:
pom: ./pomJava8.xml
- name: Get version number for pom.xml
id: java
uses: JActions/maven-version@v1.2.0
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
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
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
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]
steps:
- name: Download jar files from artifacts
uses: actions/download-artifact@v3.0.1
with:
name: jarfiles
- name: Create release v${{ needs.get_versions.outputs.version_8 }}
uses: ncipollo/release-action@v1.11.2
with:
name: NeqSim ${{ needs.get_versions.outputs.version_8 }}
tag: v${{ needs.get_versions.outputs.version_8 }}
draft: true
generateReleaseNotes: true
skipIfReleaseExists: true
artifactErrorsFailBuild: true
artifacts: "*.jar"
artifactContentType: application/java-archive
# # Needs to delete the old jars manually
# - run: mkdir lib && cp *.jar lib/
# - run: cd lib && mkdir libj8 && mv *Java8.jar libj8/ && cd ..
# - name: Create release branch in neqsimpython repo
# uses: GuillaumeFalourd/create-other-repo-branch-action@v1.5
# with:
# repository_owner: Equinor
# repository_name: neqsimpython
# new_branch_name: NeqSim-jars-updated-${{ needs.get_versions.outputs.version_8 }}
# ssh_deploy_key: ${{ secrets.SSH_DEPLOY_KEY }}
# - name: Push directory to another repository
# uses: cpina/github-action-push-to-another-repository@v1.5.1
# env:
# SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }}
# with:
# source-directory: 'lib'
# destination-github-username: 'equinor'
# destination-repository-name: 'neqsimpython'
# user-email: asmf@equinor.com
# target-branch: NeqSim-jars-updated-${{ needs.get_versions.outputs.version_8 }}
# target-directory: neqsim/lib
# commit_message: 'chore: updated jar-files'