Workflow: Upload a Build Artifact #113
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
branches: | |
- master | |
- develop | |
pull_request: | |
branches: | |
- develop | |
jobs: | |
build_and_test: | |
name: Build and Test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- 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 # skip tests, coverage, etc. | |
run: ./gradlew assembleDebug --stacktrace -x test | |
- 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-debug-$DATE.apk | |
echo "ARTIFACT_DATE=$DATE" >> $GITHUB_ENV | |
- name: Upload a Build Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: debug-${{ env.ARTIFACT_DATE }} | |
path: app/build/outputs/apk/debug/OSMTracker-debug-*.apk |