diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2aecb7c..8576758 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,4 +1,4 @@ -name: Build & Release +name: Debug & Release on: # Triggers the workflow on every pull request to master branch @@ -17,7 +17,7 @@ on: workflow_dispatch: jobs: - build: + debug: runs-on: ubuntu-latest defaults: run: @@ -40,12 +40,42 @@ jobs: distribution: 'temurin' java-version: '11' - - name: Build the app + - name: Build debug APK + run: ./gradlew assembleDebug + + - name: Upload debug APK + uses: actions/upload-artifact@v2 + with: + name: app-debug + path: ./Android/MSTG-Android-Kotlin-App/app/build/outputs/apk/debug/app-debug.apk + + release: + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') + defaults: + run: + working-directory: Android/MSTG-Android-Kotlin-App + + steps: + - name: Checkout the code + uses: actions/checkout@v2 + + - uses: actions/cache@v2 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/buildSrc/**/*.kt') }} + + - name: Set up JDK + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '11' + + - name: Build release APK run: ./gradlew assembleRelease - - - name: List Downloaded artifacts (sampling of download-artifact) - run: ls -l - + - uses: ilharp/sign-android-release@v1 name: Sign app APK # ID used to access action output @@ -57,24 +87,9 @@ jobs: keyStorePassword: ${{ secrets.SIGNING_STORE_PASSWORD }} keyPassword: ${{ secrets.SIGNING_KEY_PASSWORD }} - - name: Rename build + - name: Rename signed APK run: mv ./app/build/outputs/apk/release/app-release-unsigned-signed.apk ./app/build/outputs/apk/release/MASTG-Android.apk - - name: Upload APK - uses: actions/upload-artifact@v2 - with: - name: app-release - path: ./Android/MSTG-Android-Kotlin-App/app/build/outputs/apk/release/MASTG-Android.apk - - release: - runs-on: ubuntu-latest - needs: [build] - if: startsWith(github.ref, 'refs/tags/') - steps: - - uses: actions/download-artifact@v2 - - name: List Downloaded artifacts (sampling of download-artifact) - run: ls -l - - name: Release uses: softprops/action-gh-release@v1 with: @@ -82,6 +97,6 @@ jobs: draft: true generate_release_notes: true files: | - app-release/*.apk + ./app/build/outputs/apk/release/MASTG-Android.apk env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}