Skip to content

Commit

Permalink
Workflow: add build and nightly actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Binnette committed Nov 28, 2024
1 parent d1092f2 commit b7c58e6
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 1 deletion.
32 changes: 32 additions & 0 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build

on:
push:
branches:
- master
- develop
pull_request:
branches:
- develop

jobs:
build:
name: Build and Test
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/[email protected]

- name: Setup Java JDK
uses: actions/[email protected]
with:
distribution: 'temurin'
java-version: '17'
cache: 'gradle'

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build with Gradle # skip tests, coverage, etc.
run: ./gradlew build -x test --stacktrace
55 changes: 55 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
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/[email protected]
with:
ref: ${{ github.event.inputs.branch }}

- name: Setup Java JDK
uses: actions/[email protected]
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
- 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/[email protected]
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 }}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=cb87f222c5585bd46838ad4db78463a5c5f3d336e5e2b98dc7c0c586527351c2
distributionSha256Sum=3e1af3ae886920c3ac87f7a91f816c0c7c436f276a6eefdb3da152100fef72ae
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

0 comments on commit b7c58e6

Please sign in to comment.