diff --git a/.github/scripts/create-repo.sh b/.github/scripts/create-repo.sh index 23de7afd6..37f228bb6 100755 --- a/.github/scripts/create-repo.sh +++ b/.github/scripts/create-repo.sh @@ -1,24 +1,18 @@ #!/bin/bash set -e -shopt -s globstar nullglob extglob TOOLS="$(ls -d ${ANDROID_HOME}/build-tools/* | tail -1)" mkdir -p repo/apk mkdir -p repo/icon + +cp -f apk/* repo/apk + cd repo -APKS=( ../../apk/**/*".apk" ) - -# Fail if too little extensions seem to have been built -if [ "${#APKS[@]}" -le "1" ]; then - echo "Insufficient amount of APKs found. Please check the project configuration." - exit 1 -fi +APKS=( ../apk/*".apk" ) for APK in ${APKS[@]}; do - cp $APK ./apk - FILENAME=$(basename ${APK}) BADGING="$(${TOOLS}/aapt dump --include-meta-data badging $APK)" @@ -37,7 +31,7 @@ for APK in ${APKS[@]}; do unzip -p $APK $ICON > icon/${FILENAME%.*}.png SOURCE_INFO=$(jq ".[\"$PKGNAME\"]" < ../output.json) - + # Fixes the language code without needing to update the packages. SOURCE_LEN=$(echo $SOURCE_INFO | jq length) diff --git a/.github/scripts/sign-apks.sh b/.github/scripts/sign-apks.sh index 3ec8f01ea..34775f70b 100755 --- a/.github/scripts/sign-apks.sh +++ b/.github/scripts/sign-apks.sh @@ -4,8 +4,17 @@ shopt -s globstar nullglob extglob TOOLS="$(ls -d ${ANDROID_HOME}/build-tools/* | tail -1)" +# Get APKs from previous jobs' artifacts +cp -R ~/apk-artifacts/ $PWD APKS=( **/*".apk" ) -echo "Signing ${#APKS[@]} APKs" + +# Fail if too little extensions seem to have been built +if [ "${#APKS[@]}" -le "1" ]; then + echo "Insufficient amount of APKs found. Please check the project configuration." + exit 1 +else + echo "Signing ${#APKS[@]} APKs" +fi # Take base64 encoded key input and put it into a file STORE_PATH=$PWD/signingkey.jks diff --git a/.github/workflows/build_pull_request.yml b/.github/workflows/build_pull_request.yml index 3e429b0d1..437998457 100644 --- a/.github/workflows/build_pull_request.yml +++ b/.github/workflows/build_pull_request.yml @@ -36,19 +36,25 @@ jobs: cp .github/runner-files/ci-gradle.properties ~/.gradle/gradle.properties - name: Generate sources from the multi-source library - uses: gradle/gradle-command-action@v2 + uses: gradle/gradle-command-action@v1 env: CI_MULTISRC: "true" with: arguments: :multisrc:generateExtensions + distributions-cache-enabled: true + dependencies-cache-enabled: true + configuration-cache-enabled: true - name: Build "${{ matrix.lang }}" extensions - uses: gradle/gradle-command-action@v2 + uses: gradle/gradle-command-action@v1 env: CI_MULTISRC: "true" CI_MATRIX_LANG: ${{ matrix.lang }} with: arguments: assembleRelease + distributions-cache-enabled: true + dependencies-cache-enabled: true + configuration-cache-enabled: true build_individual: name: Build individual modules @@ -72,9 +78,12 @@ jobs: cp .github/runner-files/ci-gradle.properties ~/.gradle/gradle.properties - name: Build "${{ matrix.lang }}" extensions - uses: gradle/gradle-command-action@v2 + uses: gradle/gradle-command-action@v1 env: CI_MULTISRC: "false" CI_MATRIX_LANG: ${{ matrix.lang }} with: arguments: assembleRelease + distributions-cache-enabled: true + dependencies-cache-enabled: true + configuration-cache-enabled: true diff --git a/.github/workflows/build_push.yml b/.github/workflows/build_push.yml index d0d646cb4..afb084814 100644 --- a/.github/workflows/build_push.yml +++ b/.github/workflows/build_push.yml @@ -44,35 +44,31 @@ jobs: cp .github/runner-files/ci-gradle.properties ~/.gradle/gradle.properties - name: Generate sources from the multi-source library - uses: gradle/gradle-command-action@v2 + uses: gradle/gradle-command-action@v1 env: CI_MULTISRC: "true" with: arguments: :multisrc:generateExtensions + distributions-cache-enabled: true + dependencies-cache-enabled: true + configuration-cache-enabled: true - name: Build "${{ matrix.lang }}" extensions - uses: gradle/gradle-command-action@v2 + uses: gradle/gradle-command-action@v1 env: CI_MULTISRC: "true" CI_MATRIX_LANG: ${{ matrix.lang }} with: arguments: assembleRelease - - - name: Sign APKs - if: "github.repository == 'tachiyomiorg/tachiyomi-extensions'" - run: | - ./.github/scripts/sign-apks.sh \ - ${{ secrets.SIGNING_KEY }} \ - ${{ secrets.ALIAS }} \ - ${{ secrets.KEY_STORE_PASSWORD }} \ - ${{ secrets.KEY_PASSWORD }} + distributions-cache-enabled: true + dependencies-cache-enabled: true + configuration-cache-enabled: true - name: Upload "${{ matrix.lang }}" APKs - if: "github.repository == 'tachiyomiorg/tachiyomi-extensions'" uses: actions/upload-artifact@v2 with: name: "multisrc-${{ matrix.lang }}-apks" - path: "apk/*.apk" + path: "**/*.apk" retention-days: 1 build_individual: @@ -97,28 +93,21 @@ jobs: cp .github/runner-files/ci-gradle.properties ~/.gradle/gradle.properties - name: Build "${{ matrix.lang }}" extensions - uses: gradle/gradle-command-action@v2 + uses: gradle/gradle-command-action@v1 env: CI_MULTISRC: "false" CI_MATRIX_LANG: ${{ matrix.lang }} with: arguments: assembleRelease - - - name: Sign APKs - if: "github.repository == 'tachiyomiorg/tachiyomi-extensions'" - run: | - ./.github/scripts/sign-apks.sh \ - ${{ secrets.SIGNING_KEY }} \ - ${{ secrets.ALIAS }} \ - ${{ secrets.KEY_STORE_PASSWORD }} \ - ${{ secrets.KEY_PASSWORD }} + distributions-cache-enabled: true + dependencies-cache-enabled: true + configuration-cache-enabled: true - name: Upload "${{ matrix.lang }}" APKs - if: "github.repository == 'tachiyomiorg/tachiyomi-extensions'" uses: actions/upload-artifact@v2 with: name: "individual-${{ matrix.lang }}-apks" - path: "apk/*.apk" + path: "**/*.apk" retention-days: 1 publish_repo: @@ -132,7 +121,7 @@ jobs: - name: Download APK artifacts uses: actions/download-artifact@v2 with: - path: apk + path: ~/apk-artifacts - name: Checkout master branch uses: actions/checkout@v2 @@ -145,12 +134,21 @@ jobs: with: java-version: 11 + - name: Sign APKs + run: | + cd master + ./.github/scripts/sign-apks.sh \ + ${{ secrets.SIGNING_KEY }} \ + ${{ secrets.ALIAS }} \ + ${{ secrets.KEY_STORE_PASSWORD }} \ + ${{ secrets.KEY_PASSWORD }} + - name: Run inspector run: | cd master INSPECTOR_LINK="$(curl -s "https://api.github.com/repos/tachiyomiorg/tachiyomi-extensions-inspector/releases/latest" | jq -r '.assets[0].browser_download_url')" curl -L "$INSPECTOR_LINK" -o ./Inspector.jar - java -jar ./Inspector.jar "../apk" "output.json" "tmp" + java -jar ./Inspector.jar "apk" "output.json" "tmp" - name: Create repo artifacts run: |