From f19e112d0af21fc7c2ad4b08586d08b7785450f0 Mon Sep 17 00:00:00 2001 From: Sadwhy <99601717+Sadwhy@users.noreply.github.com> Date: Sun, 10 Dec 2023 01:51:27 +0600 Subject: [PATCH] Integrate GitHub runner and Discord for build updates (#79) * Added a GitHub runner and uploads it to discord * Update build.gradle * Update build.gradle * Update build.gradle * Update build.gradle * Add files via upload * Add files via upload * Add files via upload * Delete app/src/debug/google-services.json * Delete build.gradle * target dev * Add files via upload --------- Co-authored-by: rebel onion <87634197+rebelonion@users.noreply.github.com> --- .github/workflows/beta.yml | 58 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 .github/workflows/beta.yml diff --git a/.github/workflows/beta.yml b/.github/workflows/beta.yml new file mode 100644 index 0000000000..ba36e72be6 --- /dev/null +++ b/.github/workflows/beta.yml @@ -0,0 +1,58 @@ +name: Build APK and Notify Discord + +on: + push: + branches: + - main + - dev + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout repo + uses: actions/checkout@v3 + + - name: Set variables + run: | + VER=$(grep -E -o "versionName \".*\"" app/build.gradle | sed -e 's/versionName //g' | tr -d '"') + SHA=${{ github.sha }} + VERSION="$VER.${SHA:0:7}" + echo "Version $VERSION" + echo "VERSION=$VERSION" >> $GITHUB_ENV + + - name: Setup JDK 17 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: 17 + cache: gradle + + - name: Make gradlew executable + run: chmod +x ./gradlew + + - name: Build with Gradle + run: ./gradlew assembleDebug + + - name: Upload a Build Artifact + uses: actions/upload-artifact@v3.0.0 + with: + name: Dantotsu + path: "app/build/outputs/apk/debug/app-debug.apk" + + - name: Upload APK to Discord + shell: bash + run: | + contentbody=$( jq -Rsa . <<< "${{ github.event.head_commit.message }}" ) + curl -F "payload_json={\"content\":\" everyone **${{ env.VERSION }}**\n\n${contentbody:1:-1}\"}" -F "dantotsu_debug=@app/build/outputs/apk/debug/app-debug.apk" ${{ secrets.DISCORD_WEBHOOK }} + + - name: Delete Old Pre-Releases + id: delete-pre-releases + uses: sgpublic/delete-release-action@master + with: + pre-release-drop: true + pre-release-keep-count: 3 + pre-release-drop-tag: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}