From 1d10fb86c65b5036bc1ee601c3771bf47c4c7da6 Mon Sep 17 00:00:00 2001 From: Mikucat Date: Fri, 22 Dec 2023 19:37:03 +0800 Subject: [PATCH] feat(cicd): build APK artifact --- .github/workflows/build-dev-apk.yml | 33 +++++++++++++++++++++++++ .github/workflows/build-release-apk.yml | 33 +++++++++++++++++++++++++ .github/workflows/detekt.yml | 2 +- 3 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/build-dev-apk.yml create mode 100644 .github/workflows/build-release-apk.yml diff --git a/.github/workflows/build-dev-apk.yml b/.github/workflows/build-dev-apk.yml new file mode 100644 index 0000000..e9c0699 --- /dev/null +++ b/.github/workflows/build-dev-apk.yml @@ -0,0 +1,33 @@ +name: Build Dev APK + +on: + push: + branches: + - 'main' + workflow_dispatch: + +jobs: + build: + name: Build + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: '17' + + - uses: gradle/gradle-build-action@v2 + with: + gradle-version: 8.4 + + - name: Build APK + run: gradle :app:assembleRelease + + - uses: actions/upload-artifact@v4 + with: + name: apk-${{ github.sha }} + path: app/build/outputs/apk/release/app-release.apk + if-no-files-found: error diff --git a/.github/workflows/build-release-apk.yml b/.github/workflows/build-release-apk.yml new file mode 100644 index 0000000..1c3f01b --- /dev/null +++ b/.github/workflows/build-release-apk.yml @@ -0,0 +1,33 @@ +name: Build Release APK + +on: + push: + tags: + - 'v*' + workflow_dispatch: + +jobs: + build: + name: Build + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: '17' + + - uses: gradle/gradle-build-action@v2 + with: + gradle-version: 8.4 + + - name: Build APK + run: gradle :app:assembleRelease + + - uses: actions/upload-artifact@v4 + with: + name: apk-${{ github.ref_name }} + path: app/build/outputs/apk/release/app-release.apk + if-no-files-found: error diff --git a/.github/workflows/detekt.yml b/.github/workflows/detekt.yml index f18faa4..f9a54a5 100644 --- a/.github/workflows/detekt.yml +++ b/.github/workflows/detekt.yml @@ -32,7 +32,7 @@ jobs: - name: Run Detekt continue-on-error: true - run: gradle :app:detekt --no-daemon + run: gradle :app:detekt - uses: github/codeql-action/upload-sarif@v2 with: