From 3e85dcf167ac757a46cd9464c01a96657c2bbfd2 Mon Sep 17 00:00:00 2001 From: kairusds Date: Mon, 27 Dec 2021 15:03:17 +0800 Subject: [PATCH] Add debug and create-release workflows, Remove apk workflow --- .github/workflows/create-release.yml | 53 ++++++++++++++++++++++++ .github/workflows/{apk.yml => debug.yml} | 49 ++++++++++------------ 2 files changed, 75 insertions(+), 27 deletions(-) create mode 100644 .github/workflows/create-release.yml rename .github/workflows/{apk.yml => debug.yml} (76%) diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml new file mode 100644 index 00000000..c7cdbc11 --- /dev/null +++ b/.github/workflows/create-release.yml @@ -0,0 +1,53 @@ +name: Create Debug Release + +on: workflow_dispatch + +jobs: + build: + runs-on: ubuntu-latest + if: "!contains(github.event.head_commit.message, '[ci skip]')" + steps: + - uses: actions/checkout@v2 + + - name: Set up JDK 11 + uses: actions/setup-java@v2 + with: + distribution: "adopt" + java-version: 11 + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Create debug build + uses: gradle/gradle-build-action@v2 + with: + arguments: build + + - name: Set environment variables + run: | + echo "APK_PATH=$(find app/build/outputs/apk/debug/*.apk)" >> $GITHUB_ENV + echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV + + sha=`sha256sum ${{ env.APK_PATH }} | awk '{ print $1 }'` + echo "APK_SHA256=$sha" >> $GITHUB_ENV + + - name: Get apk info + id: apk-info + uses: hkusu/apk-info-action@v1 + with: + apk-path: ${{ env.APK_PATH }} + + - name: Upload binaries to a release + uses: softprops/action-gh-release@v1 + with: + body: | + Commit hash: ${{ env.COMMIT_HASH }} + APK SHA-256 Checksum: ${{ env.APK_SHA256 }} + files: ${{ env.APK_PATH }} + tag_name: ${{ steps.apk-info.outputs.version-name }} + + - name: Upload artifact + uses: actions/upload-artifact@v2 + with: + name: LADB + path: ${{ env.APK_PATH }} diff --git a/.github/workflows/apk.yml b/.github/workflows/debug.yml similarity index 76% rename from .github/workflows/apk.yml rename to .github/workflows/debug.yml index 0e201eaa..dc1fccff 100644 --- a/.github/workflows/apk.yml +++ b/.github/workflows/debug.yml @@ -1,27 +1,22 @@ -name: Android CI - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: set up JDK 11 - uses: actions/setup-java@v2 - with: - distribution: 'adopt' - java-version: 11 - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - name: Build with Gradle - run: ./gradlew assembleDebug - - name: Upload artifact - uses: actions/upload-artifact@v2 - with: - name: ladb - path: app/build/outputs/apk/ +name: Android CI + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: set up JDK 11 + uses: actions/setup-java@v2 + with: + distribution: 'adopt' + java-version: 11 + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Build with Gradle + run: ./gradlew assembleDebug