Files
keepass2android/.github/workflows/release-net.yml
2025-06-17 21:59:46 +02:00

125 lines
3.8 KiB
YAML

name: Create keepass2android release
env:
NAME: 'ReleaseNet'
on:
release:
types: [published] # Trigger when a new GitHub release is published
workflow_dispatch: # For manual testing
jobs:
build-release:
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Print name
run: echo "Hello $NAME. $BUILD. "
shell: bash
env:
BUILD: 'We are currently testing'
- name: Extract key store
env:
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}
KeyStore: "${{ github.workspace }}/kp2a_net.keystore"
MyAndroidSigningStorePass: ${{ secrets.KEY_STORE_PASSWORD }}
MyAndroidSigningKeyPass: ${{ secrets.KEY_PASSWORD }}
MyTestEnv: abcd
shell: bash
run: |
echo $KeyStore
echo ${{ github.workspace }}/kp2a_net.keystore
echo $KEYSTORE_BASE64 | base64 --decode > $KeyStore
echo "passes: "
echo $MyAndroidSigningStorePass | sha1sum | cut -c 1-5
echo $MyAndroidSigningKeyPass | sha1sum | cut -c 1-5
echo "Test env"
echo $MyTestEnv
echo $MyTestEnv | sha1sum | cut -c 1-5
echo "Key store checksum: "
cat $KeyStore | sha1sum | cut -c 1-5
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Cache NuGet packages
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('src/**/*.csproj', 'src/**/packages.config') }}
restore-keys: |
${{ runner.os }}-nuget-
# Workaround an issue when building on windows-2022. Error was
# 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]
# 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]
- name: Configure Pagefile
uses: al-cheb/configure-pagefile-action@a3b6ebd6b634da88790d9c58d4b37a7f4a7b8708 # v1.4
with:
minimum-size: 8GB
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v2
# If we want to also have nmake, use this instead
#uses: ilammy/msvc-dev-cmd@v1
- name: Switch to JDK-17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Display java version
run: java -version
# Some components of Keepass2Android currently target android API 26 which are not available on the runner
- name: Download android-26 API
shell: cmd
run: |
%ANDROID_SDK_ROOT%\cmdline-tools\latest\bin\sdkmanager --install "platforms;android-26"
- name: Build native dependencies
shell: cmd
run: |
make native
- name: Build java dependencies
shell: cmd
run: |
make java
- name: Install NuGet dependencies (net)
run: make nuget Flavor=Net
- name: Use the _net manifest
run: |
make manifestlink Flavor=Net
- name: Build APK (net)
env:
KeyStore: ${{ github.workspace }}/kp2a_net.keystore
MyAndroidSigningStorePass: ${{ secrets.KEY_STORE_PASSWORD }}
MyAndroidSigningKeyPass: ${{ secrets.KEY_PASSWORD }}
run: |
make apk Flavor=Net
- name: Archive production artifacts (net)
uses: actions/upload-artifact@v4
with:
name: signed APK ('net' built on ${{ github.job }})
path: |
src/keepass2android-app/bin/*/*-Signed.apk