|
| 1 | +name: Create keepass2android release |
| 2 | +env: |
| 3 | + NAME: 'Release' |
| 4 | + |
| 5 | +on: |
| 6 | + release: |
| 7 | + types: [published] # Trigger when a new GitHub release is published |
| 8 | + workflow_dispatch: # For manual testing |
| 9 | + |
| 10 | +jobs: |
| 11 | + |
| 12 | + build-release: |
| 13 | + |
| 14 | + runs-on: windows-2022 |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | + steps: |
| 19 | + |
| 20 | + - uses: actions/checkout@v4 |
| 21 | + with: |
| 22 | + submodules: true |
| 23 | + |
| 24 | + - name: Extract key store |
| 25 | + env: |
| 26 | + KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }} |
| 27 | + KeyStore: "${{ github.workspace }}/kp2a.keystore" |
| 28 | + |
| 29 | + shell: bash |
| 30 | + run: | |
| 31 | + echo $KeyStore |
| 32 | + echo $KEYSTORE_BASE64 | base64 --decode > $KeyStore |
| 33 | +
|
| 34 | + |
| 35 | +
|
| 36 | + - name: Setup Gradle |
| 37 | + uses: gradle/actions/setup-gradle@v3 |
| 38 | + |
| 39 | + - name: Cache NuGet packages |
| 40 | + uses: actions/cache@v4 |
| 41 | + with: |
| 42 | + path: ~/.nuget/packages |
| 43 | + key: ${{ runner.os }}-nuget-${{ hashFiles('src/**/*.csproj', 'src/**/packages.config') }} |
| 44 | + restore-keys: | |
| 45 | + ${{ runner.os }}-nuget- |
| 46 | +
|
| 47 | + # Workaround an issue when building on windows-2022. Error was |
| 48 | + # D8 : OpenJDK 64-Bit Server VM warning : INFO: os::commit_memory(0x00000000ae400000, 330301440, 0) failed; error='The paging file is too small for this operation to complete' (DOS error/errno=1455) [D:\a\keepass2android\keepass2android\src\keepass2android\keepass2android-app.csproj] |
| 49 | + # C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.D8.targets(81,5): error MSB6006: "java.exe" exited with code 1. [D:\a\keepass2android\keepass2android\src\keepass2android\keepass2android-app.csproj] |
| 50 | + - name: Configure Pagefile |
| 51 | + uses: al-cheb/configure-pagefile-action@a3b6ebd6b634da88790d9c58d4b37a7f4a7b8708 # v1.4 |
| 52 | + with: |
| 53 | + minimum-size: 8GB |
| 54 | + |
| 55 | + - name: Add msbuild to PATH |
| 56 | + uses: microsoft/setup-msbuild@v2 |
| 57 | + # If we want to also have nmake, use this instead |
| 58 | + #uses: ilammy/msvc-dev-cmd@v1 |
| 59 | + |
| 60 | + - name: Switch to JDK-17 |
| 61 | + uses: actions/setup-java@v4 |
| 62 | + with: |
| 63 | + java-version: '17' |
| 64 | + distribution: 'temurin' |
| 65 | + |
| 66 | + - name: Display java version |
| 67 | + run: java -version |
| 68 | + |
| 69 | + - name: Build native dependencies |
| 70 | + shell: cmd |
| 71 | + run: | |
| 72 | + make native |
| 73 | +
|
| 74 | + - name: Build java dependencies |
| 75 | + shell: cmd |
| 76 | + run: | |
| 77 | + make java |
| 78 | +
|
| 79 | + - name: Install NuGet dependencies (net) |
| 80 | + run: make nuget Flavor=Net |
| 81 | + |
| 82 | + - name: Use the _net manifest |
| 83 | + run: | |
| 84 | + make manifestlink Flavor=Net |
| 85 | +
|
| 86 | + - name: Build APK (net) |
| 87 | + env: |
| 88 | + KeyStore: "${{ github.workspace }}/kp2a.keystore" |
| 89 | + MyAndroidSigningStorePass: ${{ secrets.KEY_STORE_PASSWORD }} |
| 90 | + MyAndroidSigningKeyPass: ${{ secrets.KEY_PASSWORD }} |
| 91 | + run: | |
| 92 | + make Configuration=Release Flavor=Net |
| 93 | +
|
| 94 | +
|
| 95 | + - name: Install NuGet dependencies (nonet) |
| 96 | + run: make nuget Flavor=NoNet |
| 97 | + |
| 98 | + - name: Use the _nonet manifest |
| 99 | + run: | |
| 100 | + make manifestlink Flavor=NoNet |
| 101 | +
|
| 102 | + - name: Build APK (NoNet) |
| 103 | + env: |
| 104 | + KeyStore: "${{ github.workspace }}/kp2a.keystore" |
| 105 | + MyAndroidSigningStorePass: ${{ secrets.KEY_STORE_PASSWORD }} |
| 106 | + MyAndroidSigningKeyPass: ${{ secrets.KEY_PASSWORD }} |
| 107 | + run: | |
| 108 | + make Configuration=Release Flavor=NoNet |
| 109 | +
|
| 110 | + - name: List files |
| 111 | + shell: bash |
| 112 | + run: | |
| 113 | + ls src/keepass2android-app/bin/**/*.* |
| 114 | +
|
| 115 | + - name: Archive production artifacts |
| 116 | + uses: actions/upload-artifact@v4 |
| 117 | + with: |
| 118 | + name: signed APK (built on ${{ github.job }}) |
| 119 | + path: | |
| 120 | + src/keepass2android-app/bin/Release/net8.0-android/*-Signed.apk |
| 121 | + |
| 122 | + - name: Upload APK to GitHub Release |
| 123 | + uses: softprops/action-gh-release@v2 |
| 124 | + if: github.ref_type == 'tag' |
| 125 | + with: |
| 126 | + files: | |
| 127 | + src/keepass2android-app/bin/Release/net8.0-android/*-Signed.apk |
0 commit comments