2019-10-18 16:32:38 +00:00
|
|
|
name: Android
|
2024-05-11 05:33:54 +00:00
|
|
|
|
2019-10-26 01:04:01 +00:00
|
|
|
on:
|
|
|
|
push:
|
2024-01-20 12:07:33 +00:00
|
|
|
paths-ignore:
|
|
|
|
- scripts/docker/**
|
2019-10-26 01:04:01 +00:00
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
pull_request:
|
2024-01-20 12:07:33 +00:00
|
|
|
paths-ignore:
|
|
|
|
- scripts/docker/**
|
2019-10-26 01:04:01 +00:00
|
|
|
branches:
|
|
|
|
- master
|
2019-10-18 16:32:38 +00:00
|
|
|
|
|
|
|
jobs:
|
2024-05-11 05:33:54 +00:00
|
|
|
build:
|
2024-05-09 01:19:21 +00:00
|
|
|
env:
|
|
|
|
KEYSTORE_FILE: ${{ github.workspace }}/../subsurface.keystore
|
2024-05-11 05:33:54 +00:00
|
|
|
runs-on: ubuntu-latest
|
2019-10-18 16:32:38 +00:00
|
|
|
container:
|
2024-01-08 00:27:21 +00:00
|
|
|
image: docker://subsurface/android-build:5.15.2
|
2019-10-18 16:32:38 +00:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: checkout sources
|
2024-01-08 00:27:21 +00:00
|
|
|
uses: actions/checkout@v4
|
2024-05-11 05:33:54 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
submodules: recursive
|
2019-10-18 16:32:38 +00:00
|
|
|
|
2024-05-11 05:33:54 +00:00
|
|
|
- name: set the version information
|
2024-01-05 04:44:31 +00:00
|
|
|
id: version_number
|
2024-05-11 05:33:54 +00:00
|
|
|
uses: ./.github/actions/manage-version
|
|
|
|
with:
|
|
|
|
nightly-builds-secret: ${{ secrets.NIGHTLY_BUILDS }}
|
2023-12-07 05:55:12 +00:00
|
|
|
|
2024-01-08 00:27:21 +00:00
|
|
|
- name: set up the keystore
|
|
|
|
if: github.event_name == 'push'
|
2024-05-11 05:33:54 +00:00
|
|
|
env:
|
|
|
|
ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}
|
2024-01-08 00:27:21 +00:00
|
|
|
run: |
|
2024-05-11 05:33:54 +00:00
|
|
|
echo "$ANDROID_KEYSTORE_BASE64" | base64 -d > $KEYSTORE_FILE
|
2024-01-08 00:27:21 +00:00
|
|
|
|
2019-10-18 16:32:38 +00:00
|
|
|
- name: run build
|
2023-12-07 05:55:12 +00:00
|
|
|
id: build
|
2024-05-11 05:33:54 +00:00
|
|
|
env:
|
2024-05-14 02:39:51 +00:00
|
|
|
KEYSTORE_PASSWORD: pass:${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
|
2024-05-11 05:33:54 +00:00
|
|
|
KEYSTORE_ALIAS: ${{ secrets.ANDROID_KEYSTORE_ALIAS }}
|
|
|
|
BUILDNR: ${{ steps.version_number.outputs.buildnr }}
|
2019-10-18 16:32:38 +00:00
|
|
|
run: |
|
2020-11-19 20:55:39 +00:00
|
|
|
# this is rather awkward, but it allows us to use the preinstalled
|
|
|
|
# Android and Qt versions with relative paths
|
2024-05-11 05:33:54 +00:00
|
|
|
cd ..
|
2020-11-19 20:55:39 +00:00
|
|
|
ln -s /android/5.15.* .
|
|
|
|
ln -s /android/build-tools .
|
|
|
|
ln -s /android/cmdline-tools .
|
|
|
|
ln -s /android/ndk .
|
|
|
|
ln -s /android/platform-tools .
|
|
|
|
ln -s /android/platforms .
|
|
|
|
ln -s /android/tools .
|
2020-12-03 18:49:15 +00:00
|
|
|
git config --global user.email "ci@subsurface-divelog.org"
|
|
|
|
git config --global user.name "Subsurface CI"
|
2024-01-08 00:27:21 +00:00
|
|
|
git config --global --add safe.directory $GITHUB_WORKSPACE
|
|
|
|
git config --global --add safe.directory $GITHUB_WORKSPACE/libdivecomputer
|
2024-01-03 05:15:53 +00:00
|
|
|
# get the build number via curl so this works both for a pull request as well as a push
|
2024-01-10 21:42:09 +00:00
|
|
|
export OUTPUT_DIR="$GITHUB_WORKSPACE"
|
2024-05-11 05:33:54 +00:00
|
|
|
bash -x ./subsurface/packaging/android/qmake-build.sh -buildnr $BUILDNR
|
|
|
|
|
|
|
|
- name: delete the keystore
|
|
|
|
if: github.event_name == 'push'
|
|
|
|
run: |
|
|
|
|
rm $KEYSTORE_FILE
|
|
|
|
|
|
|
|
- name: publish pull request artifacts
|
|
|
|
if: github.event_name == 'pull_request'
|
|
|
|
uses: actions/upload-artifact@v4
|
|
|
|
with:
|
|
|
|
name: Subsurface-Android-${{ steps.version_number.outputs.version }}
|
|
|
|
path: Subsurface-mobile-*.apk
|
2019-10-18 16:32:38 +00:00
|
|
|
|
2023-12-07 18:10:23 +00:00
|
|
|
# only publish a 'release' on push events (those include merging a PR)
|
2023-12-07 05:55:12 +00:00
|
|
|
- name: upload binaries
|
2023-12-07 18:10:23 +00:00
|
|
|
if: github.event_name == 'push'
|
2024-05-12 23:07:05 +00:00
|
|
|
uses: softprops/action-gh-release@v2
|
2023-12-07 05:55:12 +00:00
|
|
|
with:
|
2024-01-10 21:02:48 +00:00
|
|
|
tag_name: v${{ steps.version_number.outputs.version }}
|
2024-01-11 00:03:11 +00:00
|
|
|
repository: ${{ github.repository_owner }}/nightly-builds
|
2023-12-11 00:35:16 +00:00
|
|
|
token: ${{ secrets.NIGHTLY_BUILDS }}
|
|
|
|
prerelease: false
|
|
|
|
fail_on_unmatched_files: true
|
2023-12-07 05:55:12 +00:00
|
|
|
files: |
|
2024-01-11 00:08:48 +00:00
|
|
|
Subsurface-mobile-${{ steps.version_number.outputs.version }}.apk
|