-
Notifications
You must be signed in to change notification settings - Fork 4
90 lines (78 loc) · 2.68 KB
/
build.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
name: troppical-build
on:
push:
branches: [ "*" ]
tags: [ "v*" ]
workflow_dispatch:
jobs:
Windows-build:
runs-on: windows-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Bump version
if: startsWith(github.ref, 'refs/tags/v')
run: |
$NEW_VERSION="${{ github.ref_name }}"
(Get-Content troppical.py) -replace 'version = ".*"', "version = `"$NEW_VERSION`"" | Set-Content troppical.py
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add troppical.py
git commit -m "Update version to $NEW_VERSION"
git push origin HEAD:master --force --follow-tags --verbose
shell: pwsh
- name: Cache pip
uses: actions/cache@v3
with:
path: |
~\AppData\Local\pip\Cache
~\AppData\Local\pyinstaller\Cache
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
- name: Install dependencies
run: pip install pyqt6 pyinstaller pywin32 requests
- name: Build
shell: bash
run: |
mkdir -p ${{ github.workspace }}/bin
pyinstaller --clean --onefile --icon=icon.ico --add-data "icon.ico;." --windowed troppical.py
- name: Upload troppical
uses: actions/upload-artifact@v4
with:
name: troppical-nightly
path: ${{ github.workspace }}/dist/troppical.exe
android-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Decode and save keystore
env:
ANDROID_KEYSTORE_B64: ${{ secrets.ANDROID_KEYSTORE_B64 }}
run: |
echo "$ANDROID_KEYSTORE_B64" | base64 --decode > ${{ github.workspace }}/android/app/ks.jks
- name: Build with Gradle
run: |
cd android/
chmod +x gradlew
./gradlew assembleRelease
cd ../..
env:
ANDROID_KEYSTORE_FILE: ks.jks
ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
ANDROID_KEYSTORE_PASS: ${{ secrets.ANDROID_KEYSTORE_PASS }}
- name: Upload Android Artifacts
uses: actions/upload-artifact@v4
with:
name: app-release
path: ./android/app/build/outputs/apk/release/app-release.apk