From 184c60032db53197756fa4141320b52389a6f284 Mon Sep 17 00:00:00 2001 From: Binnette Date: Thu, 5 Dec 2024 09:12:44 +0100 Subject: [PATCH] Workflow: Upload a Build Artifact --- .github/workflows/android.yml | 21 ++++++++++++++++----- .github/workflows/nightly.yml | 15 +++++++++++---- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 53658355..37fcb95e 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -10,16 +10,15 @@ on: - develop jobs: - build: + build_and_test: name: Build and Test runs-on: ubuntu-latest - steps: - name: Checkout code - uses: actions/checkout@v4.2.2 + uses: actions/checkout@v4 - name: Setup Java JDK - uses: actions/setup-java@v4.5.0 + uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: '17' @@ -29,4 +28,16 @@ jobs: run: chmod +x gradlew - name: Build with Gradle # skip tests, coverage, etc. - run: ./gradlew build -x test --stacktrace + 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 diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 396a0471..bddb3fde 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -16,12 +16,12 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v4.2.2 + uses: actions/checkout@v4 with: ref: ${{ github.event.inputs.branch }} - name: Setup Java JDK - uses: actions/setup-java@v4.5.0 + uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: '17' @@ -35,8 +35,15 @@ jobs: - name: Rename output APK run: | - DATE=$(date +'%Y%m%d%H%M') + 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 @@ -44,7 +51,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Create GitHub Nightly Release - uses: softprops/action-gh-release@v2.1.0 + uses: softprops/action-gh-release@v2 with: tag_name: 'nightly' name: 'Nightly Build'