-
Notifications
You must be signed in to change notification settings - Fork 3
72 lines (68 loc) · 2.88 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
name: Upload Release Asset
on:
release:
types: [published]
jobs:
create-release:
runs-on: ${{ matrix.os }}
strategy:
matrix:
build: [ linux, windows, macos ]
include:
- build: linux
os: ubuntu-latest
exec: theintercept
platform: x86_64-linux
- build: macos
os: macos-latest
exec: theintercept.app
platform: x86_64-macos
- build: windows
os: windows-latest
exec: theintercept
platform: x86_64-windows
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: corretto
java-version: 17
- name: Build package
run: |
VERSION=${{ github.event.release.tag_name}}
VERSION=${VERSION:1 }
# replace version property in inkplayer.properties
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i '' -e "s/version=.*/version=$VERSION/" assets/inkplayer.properties
else
sed -i -e "s/version=.*/version=$VERSION/" assets/inkplayer.properties
fi
./gradlew lwjgl3:jpackageImage
if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
echo "${{ secrets.KEYSTORE }}" | base64 --decode > $HOME/keystore.jks
VERSION_CODE=$((`echo $VERSION | cut -d. -f1` * 100 + `echo $VERSION | cut -d. -f2`))
./gradlew -Pkeystore=$HOME/keystore.jks -PstorePassword=${{ secrets.KEYSTORE_PASSWORD }} -Palias=${{ secrets.KEYALIAS }} -PkeyPassword=${{ secrets.KEY_PASSWORD }} android:assembleRelease -Pversion=$VERSION -PversionCode=$VERSION_CODE
fi
shell: bash
- name: Upload app image to Github release
run: |
staging="theintercept-${{github.event.release.tag_name}}-${{ matrix.platform }}"
mkdir "$staging"
cp -r lwjgl3/build/jpackage/${{ matrix.exec }} "$staging/"
if [ "${{ matrix.os }}" = "windows-latest" ]; then
7z a "$staging.zip" "$staging"
gh release upload ${{github.event.release.tag_name}} "$staging.zip"
else
tar czf "$staging.tar.gz" "$staging"
gh release upload ${{github.event.release.tag_name}} "$staging.tar.gz"
# Upload Android app if ubuntu-latest
if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
staging="theintercept-${{github.event.release.tag_name}}"
mv android/build/outputs/apk/release/android-release.apk "android/build/outputs/apk/release/theintercept-${{github.event.release.tag_name}}.apk"
gh release upload ${{github.event.release.tag_name}} "android/build/outputs/apk/release/theintercept-${{github.event.release.tag_name}}.apk"
fi
fi
env:
GITHUB_TOKEN: ${{ github.TOKEN }}
shell: bash