-
Notifications
You must be signed in to change notification settings - Fork 30
144 lines (128 loc) · 4.55 KB
/
release_with_jars.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
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