diff --git a/.github/workflows/TachiyomiSY-Preview-Builder.yml b/.github/workflows/TachiyomiSY-Preview-Builder.yml index e0bc96bef..dd9a98998 100644 --- a/.github/workflows/TachiyomiSY-Preview-Builder.yml +++ b/.github/workflows/TachiyomiSY-Preview-Builder.yml @@ -7,34 +7,42 @@ on: repository_dispatch: jobs: - ping-pong: + check_wrapper: + name: Validate Gradle Wrapper runs-on: ubuntu-latest + steps: - - uses: actions/checkout@master - with: - fetch-depth: '0' - - name: Set CISKIP flag to false - run: echo ::set-env name=CISKIP::'false' - - name: Set CISKIP flag if action has ci skip - if: contains(github.event.action, 'skip-ci') || contains(github.event.action, 'skip-ci') || contains(github.event.action, 'skip ci') || contains(github.event.action, 'ci skip') || contains(github.event.action, 'ci-skip') - run: echo ::set-env name=CISKIP::'true' - - name: Exho - run: echo env.CISKIP + - name: Clone repo + uses: actions/checkout@v2 + + - name: Validate Gradle Wrapper + uses: gradle/wrapper-validation-action@v1 + + preview: + name: Build app preview + needs: check_wrapper + if: "!startsWith(github.event.head_commit.message, '[SKIP CI]')" + runs-on: ubuntu-latest + + steps: + - name: Clone repo + uses: actions/checkout@v2 + - name: TAG - Bump version and push tag uses: anothrNick/github-tag-action@1.17.2 - if: github.event.action != 'pong' && env.CISKIP == 'false' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} WITH_V: true RELEASE_BRANCHES: master DEFAULT_BUMP: patch + - name: PING - Dispatch initiating repository event - if: github.event.action != 'pong' && env.CISKIP == 'false' run: | curl -X POST https://api.github.com/repos/jobobby04/TachiyomiSYPreview/dispatches \ -H 'Accept: application/vnd.github.everest-preview+json' \ -u ${{ secrets.ACCESS_TOKEN }} \ --data '{"event_type": "ping", "client_payload": { "repository": "'"$GITHUB_REPOSITORY"'" }}' + - name: ACK - Acknowledge pong from remote repository if: github.event.action == 'pong' run: | diff --git a/.github/workflows/TachiyomiSY-Release-Builder.yml b/.github/workflows/TachiyomiSY-Release-Builder.yml index 9d5f4512e..0bd1f3848 100644 --- a/.github/workflows/TachiyomiSY-Release-Builder.yml +++ b/.github/workflows/TachiyomiSY-Release-Builder.yml @@ -6,22 +6,42 @@ on: - 'release' jobs: - apk: + check_wrapper: + name: Validate Gradle Wrapper runs-on: ubuntu-latest + steps: - - uses: actions/checkout@v1 + - name: Clone repo + uses: actions/checkout@v2 + + - name: Validate Gradle Wrapper + uses: gradle/wrapper-validation-action@v1 + + build: + name: Build app release + needs: check_wrapper + if: "!startsWith(github.event.head_commit.message, '[SKIP CI]')" + runs-on: ubuntu-latest + + steps: + - name: Cancel previous runs + uses: styfle/cancel-workflow-action@0.5.0 + with: + access_token: ${{ github.token }} + + - name: Clone repo + uses: actions/checkout@v2 + - name: Set up JDK 1.8 uses: actions/setup-java@v1 with: java-version: 1.8 - - name: Get NDK - run: sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;21.0.6113669" - - name: Cache Gradle packages - uses: actions/cache@v2 - with: - path: ~/.gradle/caches - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} - restore-keys: ${{ runner.os }}-gradle + + - name: Copy CI gradle.properties + run: | + mkdir -p ~/.gradle + cp .github/runner-files/ci-gradle.properties ~/.gradle/gradle.properties + - name: Write google-services.json uses: DamianReeves/write-file-action@v1.0 with: @@ -31,8 +51,15 @@ jobs: contents: ${{ secrets.GOOGLE_SERVICES_TEXT }} # The mode of writing to use: `overwrite`, `append`, or `preserve`. write-mode: overwrite # optional, default is preserve - - name: Build Release APK - run: bash ./gradlew assembleRelease --stacktrace + + - name: Build app + uses: eskatos/gradle-command-action@v1 + with: + arguments: assembleRelease --stacktrace + wrapper-cache-enabled: true + dependencies-cache-enabled: true + configuration-cache-enabled: true + - name: Sign Android Release uses: r0adkll/sign-android-release@v1 with: @@ -46,6 +73,7 @@ jobs: keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }} # The password for the key keyPassword: ${{ secrets.KEY_PASSWORD }} + - name: Create Release id: create_release uses: actions/create-release@v1 @@ -56,6 +84,7 @@ jobs: release_name: TachiyomiSY draft: true prerelease: false + - name: Upload Release APK uses: actions/upload-release-asset@v1 env: @@ -64,4 +93,4 @@ jobs: upload_url: ${{ steps.create_release.outputs.upload_url }} asset_path: ${{ env.SIGNED_RELEASE_FILE }} asset_name: TachiyomiSY.apk - asset_content_type: application/vnd.android.package-archive + asset_content_type: application/vnd.android.package-archive \ No newline at end of file