-
Notifications
You must be signed in to change notification settings - Fork 106
110 lines (99 loc) · 4.22 KB
/
release.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
name: Make image
on:
release:
types: [published, edited]
jobs:
build:
strategy:
fail-fast: true
matrix:
os: [windows-latest, ubuntu-latest, macOS-latest]
include:
- os: windows-latest
displayName: Windows
prefix: win
app-image: bsl-language-server
- os: ubuntu-latest
displayName: Linux
prefix: nix
app-image: bsl-language-server
- os: macOS-latest
displayName: MacOS
prefix: mac
app-image: bsl-language-server.app
runs-on: ${{ matrix.os }}
name: (${{ matrix.displayName }}) create image app version
steps:
- name: Checkout source
uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
- name: Build bootJar with Gradle
run: ./gradlew check bootJar
- name: Build jpackage app-image
run: |
import os
import platform
import re
import ntpath
import shutil
pattern = r"bsl.+\.jar"
thisPlatform = platform.system();
isWindows = False
if thisPlatform == 'Windows':
isWindows = True
if isWindows:
dirName = os.getcwd() + "\\build\\libs"
else:
dirName = os.getcwd() + "/build/libs"
def start():
fullname = get_bslls_jar(dirName)
if (fullname == None):
exit
cmdArgs = ['jpackage']
cmdArgs.append('--name')
cmdArgs.append('bsl-language-server')
cmdArgs.append('--input')
cmdArgs.append('build/libs')
cmdArgs.append('--main-jar')
cmdArgs.append(fullname)
if isWindows:
cmdArgs.append('--win-console')
cmdArgs.append('--type')
cmdArgs.append('app-image')
cmdArgs.append('--java-options')
cmdArgs.append('-Xmx2g')
cmd = ' '.join(cmdArgs)
os.system(cmd)
shutil.make_archive("bsl-language-server_" + "${{ matrix.prefix }}", 'zip', './',"${{ matrix.app-image }}")
def get_bslls_jar(dir):
names = os.listdir(dir)
for name in names:
fullname = os.path.join(dir, name)
if os.path.isfile(fullname) and re.search(pattern, fullname) and fullname.find('exec.jar') != -1:
return ntpath.basename(fullname)
return None
start()
shell: python
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: bsl-language-server_${{ matrix.prefix }}.zip
path: ./${{ matrix.app-image }}
- name: Upload assets to release
uses: AButler/[email protected]
with:
files: './bsl-language-server_${{ matrix.prefix }}.zip'
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build with Gradle
if: matrix.prefix == 'nix'
run: ./gradlew build
- name: Upload jar to release
if: matrix.prefix == 'nix'
uses: AButler/[email protected]
with:
files: './build/libs/*.jar'
repo-token: ${{ secrets.GITHUB_TOKEN }}