Skip to content

Commit

Permalink
Workflow: Upload a Build Artifact
Browse files Browse the repository at this point in the history
  • Loading branch information
Binnette committed Dec 5, 2024
1 parent b7c58e6 commit 184c600
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 9 deletions.
21 changes: 16 additions & 5 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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
15 changes: 11 additions & 4 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -35,16 +35,23 @@ 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
env:
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'
Expand Down

0 comments on commit 184c600

Please sign in to comment.