From a8b1e38b0ae6755d41670197ac6cba5faadf403b Mon Sep 17 00:00:00 2001 From: 5ec1cff Date: Sat, 9 Sep 2023 09:32:54 +0800 Subject: [PATCH] Add ci & dependabot --- .github/dependabot.yml | 20 +++++++++++ .github/workflows/ci.yml | 71 ++++++++++++++++++++++++++++++++++++++++ gradlew | 0 3 files changed, 91 insertions(+) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/ci.yml mode change 100644 => 100755 gradlew diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..60297c5 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,20 @@ +version: 2 +updates: + - package-ecosystem: gradle + directory: "/" + schedule: + interval: daily + time: "21:00" + open-pull-requests-limit: 10 + target-branch: master + registries: + - maven-google + - gradle-plugin + +registries: + maven-google: + type: maven-repository + url: "https://dl.google.com/dl/android/maven2/" + gradle-plugin: + type: maven-repository + url: "https://plugins.gradle.org/m2/" \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..61370b3 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,71 @@ +name: CI + +on: + workflow_dispatch: + push: + branches: [ master ] + tags: [ v* ] + pull_request: + merge_group: + +jobs: + build: + runs-on: ubuntu-latest + env: + CCACHE_COMPILERCHECK: "%compiler% -dumpmachine; %compiler% -dumpversion" + CCACHE_NOHASHDIR: "true" + CCACHE_HARDLINK: "true" + CCACHE_BASEDIR: "${{ github.workspace }}" + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: "recursive" + fetch-depth: 0 + + - name: Write key + if: ${{ ( github.event_name != 'pull_request' && github.ref == 'refs/heads/master' ) || github.ref_type == 'tag' }} + run: | + if [ ! -z "${{ secrets.KEY_STORE }}" ]; then + echo androidStorePassword='${{ secrets.KEY_STORE_PASSWORD }}' >> gradle.properties + echo androidKeyAlias='${{ secrets.ALIAS }}' >> gradle.properties + echo androidKeyPassword='${{ secrets.KEY_PASSWORD }}' >> gradle.properties + echo androidStoreFile='key.jks' >> gradle.properties + echo ${{ secrets.KEY_STORE }} | base64 --decode > key.jks + fi + + - name: Setup Java + uses: actions/setup-java@v3 + with: + distribution: "temurin" + java-version: "17" + + - name: Setup Gradle + uses: gradle/gradle-build-action@v2 + with: + gradle-home-cache-cleanup: true + + - name: Build with Gradle + run: | + ./gradlew assemble + + - name: Upload release + uses: actions/upload-artifact@v3 + with: + name: "RoTieba-release-ci" + path: "./app/build/outputs/apk/release/app-release.apk" + + - name: Upload release mapping + uses: actions/upload-artifact@v3 + with: + name: "release-mappings" + path: "./app/build/outputs/mapping/release/" + + - name: Upload debug + uses: actions/upload-artifact@v3 + with: + name: "RoTieba-debug-ci" + path: "./app/build/outputs/apk/debug/app-debug.apk" + + diff --git a/gradlew b/gradlew old mode 100644 new mode 100755