forked from apache/incubator-kie-kogito-apps
-
Notifications
You must be signed in to change notification settings - Fork 0
155 lines (133 loc) · 6.37 KB
/
publish-jitexecutor-native.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
145
146
147
148
149
150
151
152
153
154
155
name: "Publish jitexecutor-native"
on:
schedule:
- cron: '0 16 * * 0' # Every sunday at 4:00PM
jobs:
build_jitexecutor_native_binaries:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Get current date
id: date
run: echo "CURRENT_DATE=$(date +'%Y%m%d')" >> "$GITHUB_OUTPUT"
shell: bash
- name: Set version
id: version
run: |
VERSION="999-${{ steps.date.outputs.CURRENT_DATE }}"
echo "TAG=$VERSION" >> "$GITHUB_OUTPUT"
echo "PROJECT_VERSION=$VERSION-SNAPSHOT" >> "$GITHUB_OUTPUT"
echo "NPM_VERSION=999.0.0-${{ steps.date.outputs.CURRENT_DATE }}-SNAPSHOT" >> "$GITHUB_OUTPUT"
shell: bash
- name: "Set long paths for Windows"
if: runner.os == 'Windows'
run: git config --system core.longpaths true
- name: "Checkout kie-kogito-apps"
uses: actions/checkout@v3
with:
repository: apache/incubator-kie-kogito-apps
ref: ${{ steps.version.outputs.TAG }}
- name: "Set up Maven"
uses: stCarolas/[email protected]
with:
maven-version: 3.9.3
- name: "Set up JDK 17"
if: runner.os != 'Windows'
uses: actions/setup-java@v3
with:
java-version: "17"
distribution: "zulu"
- name: "Build macOS"
if: runner.os == 'macOS'
run: |
brew install make && \
wget https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-17.0.9/graalvm-community-jdk-17.0.9_macos-x64_bin.tar.gz && \
tar -xzf graalvm-community-jdk-17.0.9_macos-x64_bin.tar.gz && \
sudo mv graalvm-community-openjdk-17.0.9+9.1 /Library/Java/JavaVirtualMachines/graalvm-community-openjdk-17.0.9+9.1
export PATH=/Library/Java/JavaVirtualMachines/graalvm-community-openjdk-17.0.9+9.1/Contents/Home/bin:$PATH && \
export GRAALVM_HOME=/Library/Java/JavaVirtualMachines/graalvm-community-openjdk-17.0.9+9.1/Contents/Home && \
gu install native-image && \
mvn -B -fae -ntp -N -e versions:update-parent -DparentVersion="[${{ steps.version.outputs.PROJECT_VERSION }}]" -DallowSnapshots=true -DgenerateBackupPoms=false
mvn -B -fae -ntp -N -e versions:update-child-modules -DallowSnapshots=true -DgenerateBackupPoms=false
mvn clean package -B -ntp -DskipTests -f ./jitexecutor && mvn clean package -B -ntp -DskipTests -Pnative -am -f ./jitexecutor
- name: "Build Linux"
if: runner.os == 'Linux'
run: |
sudo apt update && \
sudo apt install -y \
build-essential \
libgtk-3-dev \
libappindicator3-dev \
gir1.2-appindicator3-0.1 && \
mvn -B -fae -ntp -N -e versions:update-parent -DparentVersion="[${{ steps.version.outputs.PROJECT_VERSION }}]" -DallowSnapshots=true -DgenerateBackupPoms=false
mvn -B -fae -ntp -N -e versions:update-child-modules -DallowSnapshots=true -DgenerateBackupPoms=false
mvn clean package -B -ntp -DskipTests -f ./jitexecutor && mvn clean package -B -ntp -DskipTests -Pnative -am -f ./jitexecutor
- name: "Configure Pagefile"
if: runner.os == 'Windows'
uses: al-cheb/configure-pagefile-action@86589fd789a4de3e62ba628dda2cb10027b66d67 #v1.3
with:
minimum-size: 16GB
maximum-size: 16GB
disk-root: "C:"
- name: "Setup MSCV"
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
- name: "Setup MSBUILD"
if: runner.os == 'Windows'
uses: microsoft/setup-msbuild@v1
- name: "Setup GraalVM"
if: runner.os == 'Windows'
uses: graalvm/setup-graalvm@v1
with:
java-version: "17"
components: "native-image"
- name: "Build Windows"
if: runner.os == 'Windows'
shell: pwsh
run: |
mvn -B -fae -ntp -N -e versions:update-parent -DparentVersion="[${{ steps.version.outputs.PROJECT_VERSION }}]" -DallowSnapshots=true -DgenerateBackupPoms=false
mvn -B -fae -ntp -N -e versions:update-child-modules -DallowSnapshots=true -DgenerateBackupPoms=false
mvn clean package -B -ntp -DskipTests -f ./jitexecutor && mvn clean package -B -ntp -DskipTests -Pnative -am -f ./jitexecutor
- name: "Upload JIT Executor binary"
uses: actions/upload-artifact@v3
with:
name: jitexecutor_${{ runner.os }}
path: ./jitexecutor/jitexecutor-runner/target/jitexecutor-runner-${{ steps.version.outputs.PROJECT_VERSION }}-run*
outputs:
package_version: ${{ steps.version.outputs.PROJECT_VERSION }}
npm_version: ${{ steps.version.outputs.NPM_VERSION }}
pack_and_publish:
runs-on: ubuntu-latest
needs: [build_jitexecutor_native_binaries]
steps:
- name: "Checkout kie-kogito-apps"
uses: actions/checkout@v3
- name: "Download Windows binary"
uses: actions/download-artifact@v2
with:
name: jitexecutor_Windows
path: ./.github/supporting-files/publish_jitexecutor_native/dist/win32
- name: "Download macOS binary"
uses: actions/download-artifact@v2
with:
name: jitexecutor_macOS
path: ./.github/supporting-files/publish_jitexecutor_native/dist/darwin
- name: "Download Linux binary"
uses: actions/download-artifact@v2
with:
name: jitexecutor_Linux
path: ./.github/supporting-files/publish_jitexecutor_native/dist/linux
- name: "Pack and publish"
working-directory: ./.github/supporting-files/publish_jitexecutor_native
env:
NPM_TOKEN: ${{ secrets.KIEGROUP_NPM_TOKEN }}
run: |
mv ./dist/linux/jitexecutor-runner-${{ needs.build_jitexecutor_native_binaries.outputs.package_version }}-runner ./dist/linux/jitexecutor
mv ./dist/darwin/jitexecutor-runner-${{ needs.build_jitexecutor_native_binaries.outputs.package_version }}-runner ./dist/darwin/jitexecutor
mv ./dist/win32/jitexecutor-runner-${{ needs.build_jitexecutor_native_binaries.outputs.package_version }}-runner.exe ./dist/win32/jitexecutor.exe
npm version ${{ needs.build_jitexecutor_native_binaries.outputs.npm_version }}
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
npm publish --access public