2020-11-13 00:22:02 +00:00
|
|
|
name: CI
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
2022-01-20 16:02:38 +00:00
|
|
|
paths-ignore:
|
|
|
|
- '**.md'
|
2023-02-20 18:19:39 +00:00
|
|
|
- '.github/workflows/issue_moderator.yml'
|
2020-11-13 00:22:02 +00:00
|
|
|
|
2022-08-15 19:30:38 +00:00
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
2022-06-05 00:55:39 +00:00
|
|
|
env:
|
2022-06-05 15:35:24 +00:00
|
|
|
CI_CHUNK_SIZE: 65
|
2022-06-05 00:55:39 +00:00
|
|
|
|
2020-11-13 00:22:02 +00:00
|
|
|
jobs:
|
2022-06-05 00:55:39 +00:00
|
|
|
prepare:
|
|
|
|
name: Prepare job
|
2020-11-13 00:22:02 +00:00
|
|
|
runs-on: ubuntu-latest
|
2022-06-05 00:55:39 +00:00
|
|
|
outputs:
|
|
|
|
individualMatrix: ${{ steps.generate-matrices.outputs.individualMatrix }}
|
|
|
|
multisrcMatrix: ${{ steps.generate-matrices.outputs.multisrcMatrix }}
|
|
|
|
env:
|
|
|
|
CI_MODULE_GEN: true
|
2020-11-13 00:22:02 +00:00
|
|
|
steps:
|
|
|
|
- name: Clone repo
|
2023-09-22 19:41:49 +00:00
|
|
|
uses: actions/checkout@v4
|
2020-11-13 00:22:02 +00:00
|
|
|
|
|
|
|
- name: Validate Gradle Wrapper
|
|
|
|
uses: gradle/wrapper-validation-action@v1
|
|
|
|
|
2022-06-05 00:55:39 +00:00
|
|
|
- name: Set up JDK
|
2023-12-02 15:40:45 +00:00
|
|
|
uses: actions/setup-java@v4
|
2022-06-05 00:55:39 +00:00
|
|
|
with:
|
2022-06-05 13:49:54 +00:00
|
|
|
java-version: 11
|
2022-06-05 00:55:39 +00:00
|
|
|
distribution: adopt
|
|
|
|
|
|
|
|
- name: Generate multisrc sources
|
2023-07-05 11:58:38 +00:00
|
|
|
uses: gradle/gradle-build-action@v2
|
2022-06-05 00:55:39 +00:00
|
|
|
with:
|
|
|
|
arguments: :multisrc:generateExtensions
|
|
|
|
|
|
|
|
- name: Get number of modules
|
|
|
|
run: |
|
|
|
|
set -x
|
|
|
|
./gradlew -q projects | grep '.*extensions\:\(individual\|multisrc\)\:.*\:.*' > projects.txt
|
|
|
|
|
|
|
|
echo "NUM_INDIVIDUAL_MODULES=$(cat projects.txt | grep '.*\:individual\:.*' | wc -l)" >> $GITHUB_ENV
|
|
|
|
echo "NUM_MULTISRC_MODULES=$(cat projects.txt | grep '.*\:multisrc\:.*' | wc -l)" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- id: generate-matrices
|
|
|
|
name: Create output matrices
|
2023-11-15 03:08:36 +00:00
|
|
|
uses: actions/github-script@v7
|
2022-06-05 00:55:39 +00:00
|
|
|
with:
|
|
|
|
script: |
|
|
|
|
const numIndividualModules = process.env.NUM_INDIVIDUAL_MODULES;
|
|
|
|
const numMultisrcModules = process.env.NUM_MULTISRC_MODULES;
|
|
|
|
const chunkSize = process.env.CI_CHUNK_SIZE;
|
|
|
|
|
|
|
|
const numIndividualChunks = Math.ceil(numIndividualModules / chunkSize);
|
|
|
|
const numMultisrcChunks = Math.ceil(numMultisrcModules / chunkSize);
|
|
|
|
|
|
|
|
console.log(`Individual modules: ${numIndividualModules} (${numIndividualChunks} chunks of ${chunkSize})`);
|
|
|
|
console.log(`Multi-source modules: ${numMultisrcModules} (${numMultisrcChunks} chunks of ${chunkSize})`);
|
|
|
|
|
|
|
|
core.setOutput('individualMatrix', { 'chunk': [...Array(numIndividualChunks).keys()] });
|
|
|
|
core.setOutput('multisrcMatrix', { 'chunk': [...Array(numMultisrcChunks).keys()] });
|
|
|
|
|
2021-06-20 21:45:22 +00:00
|
|
|
build_multisrc:
|
|
|
|
name: Build multisrc modules
|
2022-06-05 00:55:39 +00:00
|
|
|
needs: prepare
|
2020-11-13 00:22:02 +00:00
|
|
|
runs-on: ubuntu-latest
|
2021-06-20 21:45:22 +00:00
|
|
|
strategy:
|
2022-06-05 00:55:39 +00:00
|
|
|
matrix: ${{ fromJSON(needs.prepare.outputs.multisrcMatrix) }}
|
2020-11-13 00:22:02 +00:00
|
|
|
steps:
|
|
|
|
- name: Checkout master branch
|
2023-09-22 19:41:49 +00:00
|
|
|
uses: actions/checkout@v4
|
2020-11-13 00:22:02 +00:00
|
|
|
|
2021-06-20 21:45:22 +00:00
|
|
|
- name: Set up JDK
|
2023-12-02 15:40:45 +00:00
|
|
|
uses: actions/setup-java@v4
|
2020-11-13 00:22:02 +00:00
|
|
|
with:
|
2022-06-05 13:49:54 +00:00
|
|
|
java-version: 11
|
2022-05-15 17:56:52 +00:00
|
|
|
distribution: adopt
|
2020-11-13 00:22:02 +00:00
|
|
|
|
2022-06-10 17:32:18 +00:00
|
|
|
- name: Prepare signing key
|
2020-11-13 00:22:02 +00:00
|
|
|
run: |
|
2022-01-09 19:33:34 +00:00
|
|
|
echo ${{ secrets.SIGNING_KEY }} | base64 -d > signingkey.jks
|
2020-11-13 00:22:02 +00:00
|
|
|
|
2021-02-08 14:08:45 +00:00
|
|
|
- name: Generate sources from the multi-source library
|
2023-07-05 11:58:38 +00:00
|
|
|
uses: gradle/gradle-build-action@v2
|
2021-02-13 00:16:06 +00:00
|
|
|
env:
|
2022-06-05 00:55:39 +00:00
|
|
|
CI_MODULE_GEN: "true"
|
2021-02-06 22:32:04 +00:00
|
|
|
with:
|
2022-06-05 00:55:39 +00:00
|
|
|
arguments: :multisrc:generateExtensions
|
2021-02-06 22:32:04 +00:00
|
|
|
|
2022-06-05 00:55:39 +00:00
|
|
|
- name: Build extensions (chunk ${{ matrix.chunk }})
|
2023-07-05 11:58:38 +00:00
|
|
|
uses: gradle/gradle-build-action@v2
|
2021-06-20 21:45:22 +00:00
|
|
|
env:
|
|
|
|
CI_MULTISRC: "true"
|
2022-06-05 00:55:39 +00:00
|
|
|
CI_CHUNK_NUM: ${{ matrix.chunk }}
|
2022-01-09 19:33:34 +00:00
|
|
|
ALIAS: ${{ secrets.ALIAS }}
|
|
|
|
KEY_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }}
|
|
|
|
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
|
2021-06-20 21:45:22 +00:00
|
|
|
with:
|
2022-06-05 00:55:39 +00:00
|
|
|
arguments: assembleRelease
|
2021-06-20 21:45:22 +00:00
|
|
|
|
2022-06-05 00:55:39 +00:00
|
|
|
- name: Upload APKs (chunk ${{ matrix.chunk }})
|
2023-12-19 12:47:43 +00:00
|
|
|
uses: actions/upload-artifact@v4
|
2022-01-09 19:33:34 +00:00
|
|
|
if: "github.repository == 'tachiyomiorg/tachiyomi-extensions'"
|
2021-06-20 21:45:22 +00:00
|
|
|
with:
|
2022-06-05 00:55:39 +00:00
|
|
|
name: "multisrc-apks-${{ matrix.chunk }}"
|
2021-11-28 23:06:26 +00:00
|
|
|
path: "**/*.apk"
|
2021-06-20 21:45:22 +00:00
|
|
|
retention-days: 1
|
|
|
|
|
2022-01-09 19:33:34 +00:00
|
|
|
- name: Clean up CI files
|
|
|
|
run: rm signingkey.jks
|
|
|
|
|
2021-06-20 21:45:22 +00:00
|
|
|
build_individual:
|
|
|
|
name: Build individual modules
|
2022-06-05 00:55:39 +00:00
|
|
|
needs: prepare
|
2021-06-20 21:45:22 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
2022-06-05 00:55:39 +00:00
|
|
|
matrix: ${{ fromJSON(needs.prepare.outputs.individualMatrix) }}
|
2021-06-20 21:45:22 +00:00
|
|
|
steps:
|
|
|
|
- name: Checkout master branch
|
2023-09-22 19:41:49 +00:00
|
|
|
uses: actions/checkout@v4
|
2021-06-20 21:45:22 +00:00
|
|
|
|
|
|
|
- name: Set up JDK
|
2023-12-02 15:40:45 +00:00
|
|
|
uses: actions/setup-java@v4
|
2021-06-20 21:45:22 +00:00
|
|
|
with:
|
2022-06-05 13:49:54 +00:00
|
|
|
java-version: 11
|
2022-05-15 17:56:52 +00:00
|
|
|
distribution: adopt
|
2021-06-20 21:45:22 +00:00
|
|
|
|
2022-06-10 17:32:18 +00:00
|
|
|
- name: Prepare signing key
|
2021-06-20 21:45:22 +00:00
|
|
|
run: |
|
2022-01-09 19:33:34 +00:00
|
|
|
echo ${{ secrets.SIGNING_KEY }} | base64 -d > signingkey.jks
|
2021-06-20 21:45:22 +00:00
|
|
|
|
2022-06-05 00:55:39 +00:00
|
|
|
- name: Build extensions (chunk ${{ matrix.chunk }})
|
2023-07-05 11:58:38 +00:00
|
|
|
uses: gradle/gradle-build-action@v2
|
2021-02-13 00:16:06 +00:00
|
|
|
env:
|
2021-06-20 21:45:22 +00:00
|
|
|
CI_MULTISRC: "false"
|
2022-06-05 00:55:39 +00:00
|
|
|
CI_CHUNK_NUM: ${{ matrix.chunk }}
|
2022-01-09 19:33:34 +00:00
|
|
|
ALIAS: ${{ secrets.ALIAS }}
|
|
|
|
KEY_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }}
|
|
|
|
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
|
2020-11-13 00:22:02 +00:00
|
|
|
with:
|
2022-06-05 00:55:39 +00:00
|
|
|
arguments: assembleRelease
|
2020-11-13 00:22:02 +00:00
|
|
|
|
2022-06-05 00:55:39 +00:00
|
|
|
- name: Upload APKs (chunk ${{ matrix.chunk }})
|
2023-12-19 12:47:43 +00:00
|
|
|
uses: actions/upload-artifact@v4
|
2022-01-09 19:33:34 +00:00
|
|
|
if: "github.repository == 'tachiyomiorg/tachiyomi-extensions'"
|
2021-06-20 21:45:22 +00:00
|
|
|
with:
|
2022-06-05 00:55:39 +00:00
|
|
|
name: "individual-apks-${{ matrix.chunk }}"
|
2021-11-28 23:06:26 +00:00
|
|
|
path: "**/*.apk"
|
2021-06-20 21:45:22 +00:00
|
|
|
retention-days: 1
|
|
|
|
|
2022-01-09 19:33:34 +00:00
|
|
|
- name: Clean up CI files
|
|
|
|
run: rm signingkey.jks
|
|
|
|
|
2021-06-20 21:45:22 +00:00
|
|
|
publish_repo:
|
|
|
|
name: Publish repo
|
|
|
|
needs:
|
|
|
|
- build_multisrc
|
|
|
|
- build_individual
|
|
|
|
if: "github.repository == 'tachiyomiorg/tachiyomi-extensions'"
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Download APK artifacts
|
2023-12-19 12:47:52 +00:00
|
|
|
uses: actions/download-artifact@v4
|
2021-06-20 21:45:22 +00:00
|
|
|
with:
|
2021-11-28 23:06:26 +00:00
|
|
|
path: ~/apk-artifacts
|
2021-06-20 21:45:22 +00:00
|
|
|
|
2021-08-02 14:28:45 +00:00
|
|
|
- name: Set up JDK
|
2023-12-02 15:40:45 +00:00
|
|
|
uses: actions/setup-java@v4
|
2021-08-02 14:28:45 +00:00
|
|
|
with:
|
2023-09-03 17:34:30 +00:00
|
|
|
java-version: 17
|
2022-05-15 17:56:52 +00:00
|
|
|
distribution: adopt
|
2021-08-02 14:28:45 +00:00
|
|
|
|
2022-01-09 19:33:34 +00:00
|
|
|
- name: Checkout master branch
|
2023-09-22 19:41:49 +00:00
|
|
|
uses: actions/checkout@v4
|
2022-01-09 19:33:34 +00:00
|
|
|
with:
|
|
|
|
ref: master
|
|
|
|
path: master
|
2021-11-28 23:06:26 +00:00
|
|
|
|
2022-01-09 19:33:34 +00:00
|
|
|
- name: Create repo artifacts
|
2021-08-02 14:28:45 +00:00
|
|
|
run: |
|
|
|
|
cd master
|
2022-01-09 19:33:34 +00:00
|
|
|
./.github/scripts/move-apks.sh
|
2021-08-02 14:28:45 +00:00
|
|
|
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
|
2021-11-28 23:06:26 +00:00
|
|
|
java -jar ./Inspector.jar "apk" "output.json" "tmp"
|
2020-11-13 00:22:02 +00:00
|
|
|
./.github/scripts/create-repo.sh
|
|
|
|
|
|
|
|
- name: Checkout repo branch
|
2023-09-22 19:41:49 +00:00
|
|
|
uses: actions/checkout@v4
|
2020-11-13 00:22:02 +00:00
|
|
|
with:
|
|
|
|
ref: repo
|
|
|
|
path: repo
|
|
|
|
|
|
|
|
- name: Deploy repo
|
|
|
|
run: |
|
|
|
|
cd repo
|
|
|
|
../master/.github/scripts/commit-repo.sh
|