Skip to content

Nightly Build

Nightly Build #34

Workflow file for this run

name: Nightly Build
on:
workflow_dispatch:
inputs:
release:
description: "Should release"
type: boolean
required: false
default: true
# push:
# branches:
# - master
# paths-ignore:
# - "*.md"
concurrency:
group: ${{ github.sha }}-${{ github.workflow }}-nightly
cancel-in-progress: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_TERM_COLOR: always
jobs:
nightly:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v6
with:
lfs: true
- name: Set up JDK 21
uses: actions/setup-java@v5
with:
java-version: "21"
distribution: "temurin"
cache: gradle
- name: Read versions from files
id: versions
run: |
echo "rust=$(cat app/src/main/rust/RUST_VERSION)" >> $GITHUB_OUTPUT
echo "ndk=$(cat app/src/main/rust/NDK_VERSION)" >> $GITHUB_OUTPUT
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ steps.versions.outputs.rust }}
targets: aarch64-linux-android, x86_64-linux-android
- uses: Swatinem/rust-cache@v2
with:
workspaces: "./app/src/main/rust/"
- name: Compile Rust lib
run: |
wget -q "https://dl.google.com/android/repository/android-ndk-${{ steps.versions.outputs.ndk }}-linux.zip"
unzip -q "./android-ndk-${{ steps.versions.outputs.ndk }}-linux.zip"
make SOURCE_DATE_EPOCH=0 NDK_PATH="$(pwd)/android-ndk-${{ steps.versions.outputs.ndk }}/toolchains/llvm/prebuilt/linux-x86_64/bin" DEBUG=0 -C app/src/main/rust build_install
- name: Build App
run: |
./gradlew assembleNightly
mkdir -p packages
# warning: do not use github.event syntax here
# https://stackoverflow.com/questions/71458189/github-action-workflow-call-does-not-use-up-to-date-input-values
mv app/build/outputs/apk/nightly/app-nightly.apk packages/gitnote-nightly.apk
- uses: actions/upload-artifact@v6
with:
name: gitnote-nightly
path: packages/*
if-no-files-found: error
- name: Publish release
if: ${{ github.event.inputs.release == 'true' }}
run: |
# delete previous nightly release
gh release delete nightly --yes || true
git push --delete origin nightly || true
git tag nightly
git push origin --tags
# https://cli.github.com/manual/gh_release_create
gh release create nightly --title "nightly" \
--verify-tag --prerelease --generate-notes --target $GITHUB_SHA \
./packages/*