11name : Release
22
3- on :
4- workflow_dispatch :
5- inputs :
6- release_version :
7- description : Release version
8- required : false
9- default : ' '
3+ on : workflow_dispatch
104
115jobs :
12- release :
13- name : Release
6+ pre-release :
147 runs-on : ubuntu-latest
8+ outputs :
9+ release-tag : ${{ steps.latest-tag.outputs.tag }}
1510 steps :
1611 - name : Check out repository code
1712 uses : actions/checkout@v2
@@ -23,25 +18,87 @@ jobs:
2318 distribution : ' temurin'
2419 java-version : ' 11'
2520 - name : Configure local git
26- run : |
27- git config user.name "${{ secrets.GIT_USERNAME }}"
21+ run : >-
22+ git config user.name "${{ secrets.GIT_USERNAME }}" &&
2823 git config user.email "${{ secrets.GIT_USER_EMAIL }}"
2924 - name : Release new version
30- if : ${{ github.event.inputs.release_version == '' }}
31- run : |
32- sbt "release with-defaults"
33- - name : Release the specified version
34- if : ${{ github.event.inputs.release_version != '' }}
35- run : |
36- sbt "release with-defaults release-version ${{ github.event.inputs.release_version }}"
25+ run : sbt preRelease
3726 - name : Latest tag
3827 uses : actions-ecosystem/action-get-latest-tag@v1
39- id : get- latest-tag
28+ id : latest-tag
4029 - name : Github Release
30+ id : gh_release
4131 uses : softprops/action-gh-release@v1
4232 with :
43- tag_name : ${{ steps.get- latest-tag.outputs.tag }}
33+ tag_name : ${{ steps.latest-tag.outputs.tag }}
4434 body_path : CHANGELOG.md
4535 files : |
4636 target/scala-3.1.2/polystat.jar
47- polystat-x86_64-pc-linux
37+ build-binaries :
38+ needs : pre-release
39+ runs-on : ${{ matrix.os }}
40+ strategy :
41+ fail-fast : false
42+ matrix :
43+ os : [ubuntu-latest, windows-latest]
44+ include :
45+ - os : ubuntu-latest
46+ uploaded_filename : polystat-x86_64-pc-linux
47+ local_path : polystat
48+ - os : windows-latest
49+ uploaded_filename : polystat-x86_64-pc-win32.exe
50+ local_path : polystat.exe
51+ steps :
52+ - name : Check out repository code
53+ uses : actions/checkout@v2
54+ with :
55+ token : ${{ secrets.GIT_TOKEN }}
56+ - name : Configure local git
57+ run : >-
58+ git config user.name "${{ secrets.GIT_USERNAME }}" &&
59+ git config user.email "${{ secrets.GIT_USER_EMAIL }}"
60+ - run : git pull --no-rebase
61+ - uses : olafurpg/setup-scala@v13
62+ - name : Set up Visual Studio shell
63+ uses : egor-tensin/vs-shell@v2
64+ if : ${{ matrix.os == 'windows-latest' }}
65+ - name : build native image (windows)
66+ if : ${{ matrix.os == 'windows-latest' }}
67+ shell : cmd
68+ run : >-
69+ echo %PATH% &&
70+ sbt nativeImage &&
71+ copy target\native-image\polystat-cli.exe ${{ matrix.uploaded_filename }} &&
72+ tree
73+ - name : build native image (linux)
74+ if : ${{ matrix.os != 'windows-latest' }}
75+ shell : bash
76+ run : |
77+ echo $PATH
78+ sbt "nativeImageCopy ${{ matrix.uploaded_filename }}" nativeImageRun
79+ - name : Upload release
80+ uses : softprops/action-gh-release@v1
81+ with :
82+ tag_name : ${{ needs.pre-release.outputs.release-tag }}
83+ files : ${{ matrix.uploaded_filename }}
84+ post-release :
85+ needs : build-binaries
86+ runs-on : ubuntu-latest
87+ steps :
88+ - name : Check out repository code
89+ uses : actions/checkout@v2
90+ with :
91+ token : ${{ secrets.GIT_TOKEN }}
92+ - name : Configure local git
93+ run : |
94+ git config user.name "${{ secrets.GIT_USERNAME }}"
95+ git config user.email "${{ secrets.GIT_USER_EMAIL }}"
96+ - name : setup JDK
97+ uses : actions/setup-java@v2
98+ with :
99+ distribution : ' temurin'
100+ java-version : ' 11'
101+ - run : git pull --no-rebase
102+ - name : Run post-release steps
103+ run : |
104+ sbt postRelease
0 commit comments