|
1 | | -name: Android CI |
2 | | -on: |
3 | | - push: |
4 | | - branches: [ "master" ] |
5 | | - pull_request: |
6 | | - branches: [ "master" ] |
7 | | - |
8 | | -jobs: |
9 | | - apk: |
10 | | - runs-on: ubuntu-latest |
11 | | - steps: |
12 | | - - name: Checkout repository and submodules |
13 | | - uses: actions/checkout@v3 |
14 | | - with: |
15 | | - submodules: recursive |
16 | | - fetch-depth: 0 # Needed for version generation |
17 | | - |
18 | | - - name: set up JDK 17 |
19 | | - uses: actions/setup-java@v3 |
20 | | - with: |
21 | | - java-version: '17' |
22 | | - distribution: 'temurin' |
23 | | - cache: gradle |
24 | | - |
25 | | - - name: Setup Android SDK |
26 | | - uses: android-actions/setup-android@v3 |
27 | | - |
28 | | - - name: Install Ninja and check Android SDK |
29 | | - run: | |
30 | | - sudo apt-get update |
31 | | - sudo apt-get install -y ninja-build |
32 | | - |
33 | | - - name: Set permissions for gradlew |
34 | | - run: chmod +x gradlew |
35 | | - |
36 | | - - name: Check Android SDK Details |
37 | | - run: | |
38 | | - echo "SDK Location:" |
39 | | - echo $ANDROID_SDK_ROOT |
40 | | - echo "Build Tools:" |
41 | | - ls -la $ANDROID_SDK_ROOT/build-tools/ |
42 | | - echo "Platform Tools:" |
43 | | - ls -la $ANDROID_SDK_ROOT/platform-tools/ |
44 | | - echo "NDK versions:" |
45 | | - ls -la $ANDROID_SDK_ROOT/ndk/ |
46 | | - |
47 | | - # Generate version based on date and commit |
48 | | - - name: Generate version |
49 | | - id: version |
50 | | - run: | |
51 | | - DATE=$(date +'%Y.%m.%d') |
52 | | - SHORT_SHA=$(git rev-parse --short HEAD) |
53 | | - VERSION="${DATE}-${SHORT_SHA}" |
54 | | - echo "version=${VERSION}" >> $GITHUB_OUTPUT |
55 | | - echo "Generated version: ${VERSION}" |
56 | | - |
57 | | - - name: Build |
58 | | - run: ./gradlew build |
59 | | - |
60 | | - - uses: ilharp/sign-android-release@v1 |
61 | | - name: Sign app APK |
62 | | - id: sign_app |
63 | | - with: |
64 | | - releaseDir: app/build/outputs/apk/release |
65 | | - signingKey: ${{ secrets.SIGNING_KEY }} |
66 | | - keyAlias: ${{ secrets.ALIAS }} |
67 | | - keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }} |
68 | | - keyPassword: ${{ secrets.KEY_PASSWORD }} |
69 | | - buildToolsVersion: 34.0.0 |
70 | | - |
71 | | - # Only create releases on pushes to master, not on PRs |
72 | | - - name: Create Release |
73 | | - if: github.event_name == 'push' && github.ref == 'refs/heads/master' |
74 | | - id: create_release |
75 | | - uses: actions/create-release@v1 |
76 | | - env: |
77 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
78 | | - with: |
79 | | - tag_name: v${{ steps.version.outputs.version }} |
80 | | - release_name: AIS Catcher v${{ steps.version.outputs.version }} |
81 | | - body: | |
82 | | - Automated release of AIS Catcher |
83 | | - |
84 | | - Built from commit: ${{ github.sha }} |
85 | | - |
86 | | - ## Changes |
87 | | - - Latest updates from master branch |
88 | | - |
89 | | - ## Downloads |
90 | | - - **app-debug.apk**: Debug version for testing |
91 | | - - **app-release-signed.apk**: Production-ready signed APK |
92 | | - draft: false |
93 | | - prerelease: false |
94 | | - |
95 | | - - name: Upload Debug APK to Release |
96 | | - if: github.event_name == 'push' && github.ref == 'refs/heads/master' |
97 | | - uses: actions/upload-release-asset@v1 |
98 | | - env: |
99 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
100 | | - with: |
101 | | - upload_url: ${{ steps.create_release.outputs.upload_url }} |
102 | | - asset_path: app/build/outputs/apk/debug/app-debug.apk |
103 | | - asset_name: app-debug.apk |
104 | | - asset_content_type: application/vnd.android.package-archive |
105 | | - |
106 | | - - name: Upload Signed APK to Release |
107 | | - if: github.event_name == 'push' && github.ref == 'refs/heads/master' |
108 | | - uses: actions/upload-release-asset@v1 |
109 | | - env: |
110 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
111 | | - with: |
112 | | - upload_url: ${{ steps.create_release.outputs.upload_url }} |
113 | | - asset_path: ${{ steps.sign_app.outputs.signedFile }} |
114 | | - asset_name: app-release-signed.apk |
115 | | - asset_content_type: application/vnd.android.package-archive |
116 | | - |
117 | | - # Update Edge release for backward compatibility |
118 | | - - name: Update Edge release |
119 | | - if: github.event_name == 'push' && github.ref == 'refs/heads/master' |
120 | | - env: |
121 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
122 | | - run: | |
123 | | - # Delete existing Edge release if it exists |
124 | | - gh release delete Edge --yes || true |
125 | | - # Create new Edge release |
126 | | - gh release create Edge \ |
127 | | - --title "Latest Edge Build" \ |
128 | | - --notes "Always contains the latest build from master branch. |
129 | | - |
130 | | - **Note:** This release is updated automatically and maintains the same download URLs for backward compatibility. |
131 | | - |
132 | | - For version-specific releases and automated updates, please use the numbered releases above. |
133 | | - |
134 | | - Built from commit: ${{ github.sha }} |
135 | | - Version: v${{ steps.version.outputs.version }}" \ |
136 | | - --prerelease |
137 | | - # Upload APKs to Edge release |
138 | | - gh release upload Edge app/build/outputs/apk/debug/app-debug.apk --clobber |
139 | | - gh release upload Edge ${{ steps.sign_app.outputs.signedFile }} --clobber |
140 | | -
|
141 | | - # Keep artifacts for PRs and additional backup |
142 | | - - name: Upload Debug APK Artifact |
143 | | - uses: actions/upload-artifact@v4 |
144 | | - with: |
145 | | - name: debug-apk-${{ steps.version.outputs.version }} |
146 | | - path: app/build/outputs/apk/debug/app-debug.apk |
147 | | - |
148 | | - - name: Upload Release APK Artifact |
149 | | - uses: actions/upload-artifact@v4 |
150 | | - with: |
151 | | - name: release-apk-${{ steps.version.outputs.version }} |
152 | | - path: ${{ steps.sign_app.outputs.signedFile }} |
| 1 | +name: Android CI |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: [ "master" ] |
| 5 | + pull_request: |
| 6 | + branches: [ "master" ] |
| 7 | + |
| 8 | +jobs: |
| 9 | + apk: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + steps: |
| 12 | + - name: Checkout repository and submodules |
| 13 | + uses: actions/checkout@v3 |
| 14 | + with: |
| 15 | + submodules: recursive |
| 16 | + fetch-depth: 0 # Needed for version generation |
| 17 | + |
| 18 | + - name: set up JDK 17 |
| 19 | + uses: actions/setup-java@v3 |
| 20 | + with: |
| 21 | + java-version: '17' |
| 22 | + distribution: 'temurin' |
| 23 | + cache: gradle |
| 24 | + |
| 25 | + - name: Setup Android SDK |
| 26 | + uses: android-actions/setup-android@v3 |
| 27 | + |
| 28 | + - name: Install Ninja and check Android SDK |
| 29 | + run: | |
| 30 | + sudo apt-get update |
| 31 | + sudo apt-get install -y ninja-build |
| 32 | + |
| 33 | + - name: Set permissions for gradlew |
| 34 | + run: chmod +x gradlew |
| 35 | + |
| 36 | + - name: Check Android SDK Details |
| 37 | + run: | |
| 38 | + echo "SDK Location:" |
| 39 | + echo $ANDROID_SDK_ROOT |
| 40 | + echo "Build Tools:" |
| 41 | + ls -la $ANDROID_SDK_ROOT/build-tools/ |
| 42 | + echo "Platform Tools:" |
| 43 | + ls -la $ANDROID_SDK_ROOT/platform-tools/ |
| 44 | + echo "NDK versions:" |
| 45 | + ls -la $ANDROID_SDK_ROOT/ndk/ |
| 46 | + |
| 47 | + # Generate version based on date and commit |
| 48 | + - name: Generate version |
| 49 | + id: version |
| 50 | + run: | |
| 51 | + DATE=$(date +'%Y.%m.%d') |
| 52 | + SHORT_SHA=$(git rev-parse --short HEAD) |
| 53 | + VERSION="${DATE}-${SHORT_SHA}" |
| 54 | + echo "version=${VERSION}" >> $GITHUB_OUTPUT |
| 55 | + echo "Generated version: ${VERSION}" |
| 56 | + |
| 57 | + - name: Build |
| 58 | + run: ./gradlew build |
| 59 | + |
| 60 | + - uses: ilharp/sign-android-release@v1 |
| 61 | + name: Sign app APK |
| 62 | + id: sign_app |
| 63 | + with: |
| 64 | + releaseDir: app/build/outputs/apk/release |
| 65 | + signingKey: ${{ secrets.SIGNING_KEY }} |
| 66 | + keyAlias: ${{ secrets.ALIAS }} |
| 67 | + keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }} |
| 68 | + keyPassword: ${{ secrets.KEY_PASSWORD }} |
| 69 | + buildToolsVersion: 34.0.0 |
| 70 | + |
| 71 | + # Only create releases on pushes to master, not on PRs |
| 72 | + - name: Create Release |
| 73 | + if: github.event_name == 'push' && github.ref == 'refs/heads/master' |
| 74 | + id: create_release |
| 75 | + uses: actions/create-release@v1 |
| 76 | + env: |
| 77 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 78 | + with: |
| 79 | + tag_name: v${{ steps.version.outputs.version }} |
| 80 | + release_name: AIS Catcher v${{ steps.version.outputs.version }} |
| 81 | + body: | |
| 82 | + Automated release of AIS Catcher |
| 83 | + |
| 84 | + Built from commit: ${{ github.sha }} |
| 85 | + |
| 86 | + ## Changes |
| 87 | + - Latest updates from master branch |
| 88 | + |
| 89 | + ## Downloads |
| 90 | + - **app-debug.apk**: Debug version for testing |
| 91 | + - **app-release-signed.apk**: Production-ready signed APK |
| 92 | + draft: false |
| 93 | + prerelease: false |
| 94 | + |
| 95 | + - name: Upload Debug APK to Release |
| 96 | + if: github.event_name == 'push' && github.ref == 'refs/heads/master' |
| 97 | + uses: actions/upload-release-asset@v1 |
| 98 | + env: |
| 99 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 100 | + with: |
| 101 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 102 | + asset_path: app/build/outputs/apk/debug/app-debug.apk |
| 103 | + asset_name: app-debug.apk |
| 104 | + asset_content_type: application/vnd.android.package-archive |
| 105 | + |
| 106 | + - name: Upload Signed APK to Release |
| 107 | + if: github.event_name == 'push' && github.ref == 'refs/heads/master' |
| 108 | + uses: actions/upload-release-asset@v1 |
| 109 | + env: |
| 110 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 111 | + with: |
| 112 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 113 | + asset_path: ${{ steps.sign_app.outputs.signedFile }} |
| 114 | + asset_name: app-release-signed.apk |
| 115 | + asset_content_type: application/vnd.android.package-archive |
| 116 | + |
| 117 | + # Update Edge release for backward compatibility |
| 118 | + - name: Update Edge release |
| 119 | + if: github.event_name == 'push' && github.ref == 'refs/heads/master' |
| 120 | + env: |
| 121 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 122 | + run: | |
| 123 | + # Delete existing Edge release if it exists |
| 124 | + gh release delete Edge --yes || true |
| 125 | + # Create new Edge release |
| 126 | + gh release create Edge \ |
| 127 | + --title "Latest Edge Build" \ |
| 128 | + --notes "Always contains the latest build from master branch. |
| 129 | + |
| 130 | + **Note:** This release is updated automatically and maintains the same download URLs for backward compatibility. |
| 131 | + |
| 132 | + For version-specific releases and automated updates, please use the numbered releases above. |
| 133 | + |
| 134 | + Built from commit: ${{ github.sha }} |
| 135 | + Version: v${{ steps.version.outputs.version }}" \ |
| 136 | + --prerelease |
| 137 | + # Upload APKs to Edge release |
| 138 | + gh release upload Edge app/build/outputs/apk/debug/app-debug.apk --clobber |
| 139 | + gh release upload Edge ${{ steps.sign_app.outputs.signedFile }} --clobber |
| 140 | +
|
| 141 | + # Keep artifacts for PRs and additional backup |
| 142 | + - name: Upload Debug APK Artifact |
| 143 | + uses: actions/upload-artifact@v4 |
| 144 | + with: |
| 145 | + name: debug-apk-${{ steps.version.outputs.version }} |
| 146 | + path: app/build/outputs/apk/debug/app-debug.apk |
| 147 | + |
| 148 | + - name: Upload Release APK Artifact |
| 149 | + uses: actions/upload-artifact@v4 |
| 150 | + with: |
| 151 | + name: release-apk-${{ steps.version.outputs.version }} |
| 152 | + path: ${{ steps.sign_app.outputs.signedFile }} |
0 commit comments