1+ name : Build and release
2+ on :
3+ push :
4+ branches :
5+ - publish
6+ tags :
7+ - ' *'
8+ pull_request :
9+ branches :
10+ - publish
11+ jobs :
12+ build :
13+ name : sbt assembly
14+ runs-on : ubuntu-latest
15+ container :
16+ image : eed3si9n/sbt:jdk11-alpine
17+ steps :
18+ - uses : actions/checkout@v2
19+ - name : sbt assembly
20+ run : sbt 'set assemblyOutputPath in assembly := new File("./target/alist.jar")' assembly
21+ - uses : actions/upload-artifact@v2
22+ with :
23+ path : target/alist.jar
24+
25+ release_jar :
26+ name : jar-image
27+ if : startsWith(github.ref, 'refs/tags/')
28+ needs : build
29+ runs-on : ubuntu-latest
30+ steps :
31+ - uses : actions/download-artifact@v2
32+ with :
33+ path : ./
34+ - name : Create GitHub release
35+ uses : softprops/action-gh-release@v1
36+ with :
37+ files : ' artifact/alist.jar'
38+ env :
39+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
40+
41+ release_nix :
42+ name : native-image-nix
43+ if : startsWith(github.ref, 'refs/tags/')
44+ needs : build
45+ runs-on : ${{ matrix.os }}
46+ strategy :
47+ matrix :
48+ os : [ ubuntu-18.04, macos-10.15 ]
49+ steps :
50+ - uses : DeLaGuardo/setup-graalvm@3
51+ with :
52+ graalvm-version : ' 21.2.0.java11'
53+
54+ - name : Install GraalVM's native-image extension
55+ run : gu install native-image
56+
57+ - uses : actions/download-artifact@v2
58+ with :
59+ path : ./
60+
61+ - name : Create native alist
62+ run : native-image --verbose -jar ./artifact/alist.jar alist
63+
64+ - name : Create tarball
65+ run : tar -zcvf "alist-${{ matrix.os }}.tar.gz" alist
66+
67+ # Even though this is in a matrix, it'll be idempotent
68+ - name : Create GitHub release
69+ uses : softprops/action-gh-release@v1
70+ with :
71+ files : ' alist-${{ matrix.os }}.tar.gz'
72+ env :
73+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
74+
75+ release_win :
76+ name : native-image-win
77+ if : startsWith(github.ref, 'refs/tags/')
78+ needs : build
79+ runs-on : windows-2019
80+ steps :
81+ - uses : DeLaGuardo/setup-graalvm@3
82+ with :
83+ graalvm-version : ' 20.0.0.java11'
84+
85+ - name : Install GraalVM's native-image extension
86+ run : ${{ env.JAVA_HOME }}\bin\gu.cmd install native-image
87+
88+ - uses : actions/download-artifact@v2
89+ with :
90+ path : ./
91+
92+ - name : Create native alist
93+ run : >-
94+ "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat" &&
95+ ${{ env.JAVA_HOME }}\bin\native-image.cmd --verbose -jar .\artifact\alist.jar alist
96+ shell : cmd
97+
98+ - name : Create zip
99+ run : 7z a alist-windows.zip alist.exe
100+
101+ - name : Create GitHub release
102+ uses : softprops/action-gh-release@v1
103+ with :
104+ files : ' alist-windows.zip'
105+ env :
106+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments