-
Notifications
You must be signed in to change notification settings - Fork 30
141 lines (124 loc) · 4.81 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
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@v3
- 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@v3
- name: Set up JDK 8 environment
uses: actions/setup-java@v3
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@v2
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@v3
- name: Set up JDK 11 environment
uses: actions/setup-java@v3
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@v2
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'