Repository navigation
149 lines (127 loc) · 4.99 KB
/
Copy pathandroid.yml
File metadata and controls
149 lines (127 loc) · 4.99 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
name: Android CI
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
apk:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v7
with:
submodules: recursive
fetch-depth: 0 # Needed for version generation
- name: set up JDK 17
uses: actions/setup-java@v5
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Setup Android SDK
uses: android-actions/setup-android@v4
- 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@v2
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
# Collect both APKs under stable names, used by the releases and the artifacts
- name: Stage release assets
run: |
mkdir -p dist
cp app/build/outputs/apk/debug/app-debug.apk dist/app-debug.apk
cp "${{ steps.sign_app.outputs.signedFile }}" dist/app-release-signed.apk
ls -la dist
# Only create releases on pushes to master, not on PRs
- name: Create Release
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "v${{ steps.version.outputs.version }}" \
--title "AIS Catcher v${{ steps.version.outputs.version }}" \
--target "$GITHUB_SHA" \
--notes "Automated release of AIS Catcher
Built from commit: ${{ github.sha }}
## Downloads
- **app-debug.apk**: Debug version for testing
- **app-release-signed.apk**: Production-ready signed APK" \
dist/app-debug.apk \
dist/app-release-signed.apk
# Edge keeps one long-lived release so the download URLs never change.
# The tag is force-moved rather than the release deleted and recreated:
# recreating hands out a fresh release id whose upload endpoint 404s until
# GitHub catches up, and a plain delete leaves the old tag behind.
- name: Update Edge release
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
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 }}"
git tag -f Edge "$GITHUB_SHA"
git push -f origin refs/tags/Edge
if gh release view Edge >/dev/null 2>&1; then
gh release edit Edge --title "Latest Edge Build" --notes "$NOTES" --prerelease
else
gh release create Edge --title "Latest Edge Build" --notes "$NOTES" --target "$GITHUB_SHA" --prerelease
fi
n=0
until gh release upload Edge dist/app-debug.apk dist/app-release-signed.apk --clobber; do
n=$((n + 1))
if [ "$n" -ge 5 ]; then
echo "Edge asset upload failed after $n attempts"
exit 1
fi
echo "Edge asset upload failed, retry $n in 10s"
sleep 10
done
# Keep artifacts for PRs and additional backup
- name: Upload Debug APK Artifact
uses: actions/upload-artifact@v7
with:
name: debug-apk-${{ steps.version.outputs.version }}
path: dist/app-debug.apk
- name: Upload Release APK Artifact
uses: actions/upload-artifact@v7
with:
name: release-apk-${{ steps.version.outputs.version }}
path: dist/app-release-signed.apk