From 14dd9af14a27d21f489378f3a864c0f10fcec9ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=93=83=E6=9F=92=E6=9F=92?= Date: Thu, 9 Jan 2025 16:51:21 +0800 Subject: [PATCH] test commit --- .github/workflows/qiqi_build.yml | 112 +++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 .github/workflows/qiqi_build.yml diff --git a/.github/workflows/qiqi_build.yml b/.github/workflows/qiqi_build.yml new file mode 100644 index 000000000..b22cedc39 --- /dev/null +++ b/.github/workflows/qiqi_build.yml @@ -0,0 +1,112 @@ +name: CI Build For Qiqi + +on: + pull_request: + types: [opened, synchronize] + paths-ignore: + - ".github/**" + - "!.github/workflows/**" + - ".idea/" + - "doc/*" + - "*.md" + - "app/src/assets/**" + - ".github/workflows/crowdin.yml" + - "crowdin.yml" + push: + branches: [pull] + paths-ignore: + - ".github/**" + - "!.github/workflows/**" + - ".idea/" + - "doc/*" + - "*.md" + - "app/src/assets/**" + - "crowdin.yml" + workflow_dispatch: + +jobs: + build_app: + runs-on: macos-latest + name: Build App + steps: + - name: Checkout Git Repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + submodules: true + + - name: Setup JDK + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '21' + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4 + + - name: Create Sign File + if: github.event_name != 'pull_request' + run: | + touch signing.properties + echo storePassword=${{ secrets.KEY_STORE_PASSWORD }} >> signing.properties + echo keyAlias=${{ secrets.ALIAS }} >> signing.properties + echo keyPassword='${{ secrets.KEY_STORE_PASSWORD }}' >> signing.properties + echo storeFile=../key.jks >> signing.properties + echo ${{ secrets.SIGNING_KEY }} | base64 --decode > key.jks + + - name: Build with Gradle (Canary) + if: github.event_name != 'pull_request' + shell: bash + run: | + ./gradlew assembleCanary + + - name: Find APKs + run: | + echo "APK_FILE=$(find app/build/outputs/apk/canary -name '*.apk')" >> $GITHUB_ENV + echo "APK_FILE_NAME=$(basename $APK_FILE .apk)" >> $GITHUB_ENV + + - name: Show APKs SHA256 + if: success() + run: | + echo "### Build Success" >> $GITHUB_STEP_SUMMARY + echo "|Artifact|SHA256|" >> $GITHUB_STEP_SUMMARY + echo "|:---:|:---|" >> $GITHUB_STEP_SUMMARY + APK_SHA256=($(shasum -a 256 ${{ env.APK_FILE }})) + echo "|Canary|$APK_SHA256" >> $GITHUB_STEP_SUMMARY + + - name: Upload APKs + uses: actions/upload-artifact@v4 + with: + name: ${{ env.APK_FILE_NAME }} + path: ${{ env.APK_FILE }} + compression-level: 9 + + push_to_canary: + if: github.event_name == 'push' && github.ref_type != 'tag' && !contains(github.event.head_commit.message, '[skp]') && !contains(github.event.head_commit.message, 's#') + runs-on: ubuntu-latest + name: Push to Canary + needs: build_app + steps: + - name: Download Artifacts + uses: actions/download-artifact@v4 + with: + path: artifacts + + - name: Find Artifacts + run: | + echo "APK_FILE_CANARY=$(find artifacts -name '*.apk')" >> $GITHUB_ENV + + - name: Post to Canary + env: + GROUP_ID: ${{ secrets.GROUP_ID }} + BOT_TOKEN: ${{ secrets.BOT_TOKEN }} + CANARY: ${{ env.APK_FILE_CANARY }} + COMMIT_MESSAGE: |+ + New push to GitHub + ``` + ${{ github.event.head_commit.message }} + ```by `${{ github.event.head_commit.author.name }}`) + run: | + ESCAPED=$(python3 -c 'import json,os,urllib.parse; print(urllib.parse.quote(json.dumps(os.environ["COMMIT_MESSAGE"])))') + cd ${{ github.workspace }} + curl -v "https://api.telegram.org/bot${BOT_TOKEN}/sendMediaGroup?chat_id=${GROUP_ID}&media=%5B%7B%22type%22:%22document%22,%20%22media%22:%22attach://canary%22,%22parse_mode%22:%22MarkdownV2%22,%22caption%22:${ESCAPED}%7D%5D" -F canary="@${CANARY}" \ No newline at end of file