Skip to content

Nightly APK

Nightly APK #36

Workflow file for this run

name: Nightly APK
on:
schedule: # Scheduled jobs only run on the default repository branch
- cron: "0 1 * * *"
workflow_dispatch:
inputs:
branch:
description: 'Branch to run the workflow on'
default: 'develop'
required: true
jobs:
nightly_build:
name: Nightly build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch }}
- name: Setup Java JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
cache: 'gradle'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew assembleDebug --stacktrace
- name: Rename output APK
run: |
DATE=$(date +'%Y%m%d-%H%M')
mv app/build/outputs/apk/debug/app-debug.apk app/build/outputs/apk/debug/OSMTracker-nightly-$DATE.apk
echo "ARTIFACT_DATE=$DATE" >> $GITHUB_ENV
- name: Upload a Build Artifact
uses: actions/upload-artifact@v4
with:
name: nightly-${{ env.ARTIFACT_DATE }}
path: app/build/outputs/apk/debug/OSMTracker-nightly-*.apk
- name: Delete existing Nightly release
run: gh release delete nightly --cleanup-tag --yes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create GitHub Nightly Release
uses: softprops/action-gh-release@v2
with:
tag_name: 'nightly'
name: 'Nightly Build'
draft: false
prerelease: true
files: app/build/outputs/apk/debug/OSMTracker-nightly-*.apk
body: "Nightly build for OSMTracker"
token: ${{ secrets.GITHUB_TOKEN }}