-
Notifications
You must be signed in to change notification settings - Fork 12
152 lines (131 loc) · 5.14 KB
/
android.yml
File metadata and controls
152 lines (131 loc) · 5.14 KB
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
name: Android CI
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
apk:
runs-on: ubuntu-latest
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0 # Needed for version generation
- name: set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Setup Android SDK
uses: android-actions/setup-android@v3
- name: Install Ninja and check Android SDK
run: |
sudo apt-get update
sudo apt-get install -y ninja-build
- name: Set permissions for gradlew
run: chmod +x gradlew
- name: Check Android SDK Details
run: |
echo "SDK Location:"
echo $ANDROID_SDK_ROOT
echo "Build Tools:"
ls -la $ANDROID_SDK_ROOT/build-tools/
echo "Platform Tools:"
ls -la $ANDROID_SDK_ROOT/platform-tools/
echo "NDK versions:"
ls -la $ANDROID_SDK_ROOT/ndk/
# Generate version based on date and commit
- name: Generate version
id: version
run: |
DATE=$(date +'%Y.%m.%d')
SHORT_SHA=$(git rev-parse --short HEAD)
VERSION="${DATE}-${SHORT_SHA}"
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "Generated version: ${VERSION}"
- name: Build
run: ./gradlew build
- uses: ilharp/sign-android-release@v1
name: Sign app APK
id: sign_app
with:
releaseDir: app/build/outputs/apk/release
signingKey: ${{ secrets.SIGNING_KEY }}
keyAlias: ${{ secrets.ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
buildToolsVersion: 34.0.0
# Only create releases on pushes to master, not on PRs
- name: Create Release
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.version.outputs.version }}
release_name: AIS Catcher v${{ steps.version.outputs.version }}
body: |
Automated release of AIS Catcher
Built from commit: ${{ github.sha }}
## Changes
- Latest updates from master branch
## Downloads
- **app-debug.apk**: Debug version for testing
- **app-release-signed.apk**: Production-ready signed APK
draft: false
prerelease: false
- name: Upload Debug APK to Release
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: app/build/outputs/apk/debug/app-debug.apk
asset_name: app-debug.apk
asset_content_type: application/vnd.android.package-archive
- name: Upload Signed APK to Release
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.sign_app.outputs.signedFile }}
asset_name: app-release-signed.apk
asset_content_type: application/vnd.android.package-archive
# Update Edge release for backward compatibility
- name: Update Edge release
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Delete existing Edge release if it exists
gh release delete Edge --yes || true
# Create new Edge release
gh release create Edge \
--title "Latest Edge Build" \
--notes "Always contains the latest build from master branch.
**Note:** This release is updated automatically and maintains the same download URLs for backward compatibility.
For version-specific releases and automated updates, please use the numbered releases above.
Built from commit: ${{ github.sha }}
Version: v${{ steps.version.outputs.version }}" \
--prerelease
# Upload APKs to Edge release
gh release upload Edge app/build/outputs/apk/debug/app-debug.apk --clobber
gh release upload Edge ${{ steps.sign_app.outputs.signedFile }} --clobber
# Keep artifacts for PRs and additional backup
- name: Upload Debug APK Artifact
uses: actions/upload-artifact@v4
with:
name: debug-apk-${{ steps.version.outputs.version }}
path: app/build/outputs/apk/debug/app-debug.apk
- name: Upload Release APK Artifact
uses: actions/upload-artifact@v4
with:
name: release-apk-${{ steps.version.outputs.version }}
path: ${{ steps.sign_app.outputs.signedFile }}