Tachiyomi-Extensions/.github/workflows/build_push.yml

206 lines
6.2 KiB
YAML
Raw Normal View History

2020-11-13 00:22:02 +00:00
name: CI
on:
push:
branches:
- master
paths-ignore:
- '**.md'
- '.github/workflows/issue_moderator.yml'
2020-11-13 00:22:02 +00:00
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
2022-06-05 00:55:39 +00:00
env:
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
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
uses: actions/setup-java@v3
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
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
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
uses: actions/checkout@v4
2020-11-13 00:22:02 +00:00
2021-06-20 21:45:22 +00:00
- name: Set up JDK
2022-05-15 17:56:52 +00:00
uses: actions/setup-java@v3
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
- name: Prepare signing key
2020-11-13 00:22:02 +00:00
run: |
echo ${{ secrets.SIGNING_KEY }} | base64 -d > signingkey.jks
2020-11-13 00:22:02 +00:00
- name: Generate sources from the multi-source library
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"
lib-themesources, split Genkan into single-source extensions (#5154) * lib themesources copied from SnakeDoc83/tachiyomi-extensions/library * update to the newer Genkan * update genkan generator * GenkanOriginal * code cleanup * add all Genkan sources * generate inside generated-src, res override * src override * move overrides out of library * move overrides to a better place * remove leftover generated files * remove leftover generated files * add generators main class * comment the code * Now sources are purely generated * uncomment generators * enhance comments * icons by @as280093 * fix pathing issues * nullpointerexception proof * runAllGenerators task * more flexibility in lib structure, fix a fiew errors * update github workflows * correct nonames scans directory name * rename SK Scans to Sleeping Knight Scans * fix typo * update depencencies * remove defaultRes from dependencies * fix bug with nsfw * fix nsfw generation * themesourcesLibraryVersion is included in build.gradle extVersionCode * improve javadoc * fix formatting and language code generation * comply with #5214 * common dependencies * rename and move lib/themesources into /multisrc * use not depricated form * cleanup runAllGenerators task * cleanup even more * oops extra file * remove test code * comments * update docs and refactor * update docs * requested changes * clean up dependencies * sealed dataClass * refactor * refactor string generators * bring back writeAndroidManifest * update overrideVersionCode javadoc * update overrideVersionCode javadoc * move dependency to extension source * refactor runAllGenerators * improve docs * remove extra file
2021-02-06 22:32:04 +00:00
with:
2022-06-05 00:55:39 +00:00
arguments: :multisrc:generateExtensions
lib-themesources, split Genkan into single-source extensions (#5154) * lib themesources copied from SnakeDoc83/tachiyomi-extensions/library * update to the newer Genkan * update genkan generator * GenkanOriginal * code cleanup * add all Genkan sources * generate inside generated-src, res override * src override * move overrides out of library * move overrides to a better place * remove leftover generated files * remove leftover generated files * add generators main class * comment the code * Now sources are purely generated * uncomment generators * enhance comments * icons by @as280093 * fix pathing issues * nullpointerexception proof * runAllGenerators task * more flexibility in lib structure, fix a fiew errors * update github workflows * correct nonames scans directory name * rename SK Scans to Sleeping Knight Scans * fix typo * update depencencies * remove defaultRes from dependencies * fix bug with nsfw * fix nsfw generation * themesourcesLibraryVersion is included in build.gradle extVersionCode * improve javadoc * fix formatting and language code generation * comply with #5214 * common dependencies * rename and move lib/themesources into /multisrc * use not depricated form * cleanup runAllGenerators task * cleanup even more * oops extra file * remove test code * comments * update docs and refactor * update docs * requested changes * clean up dependencies * sealed dataClass * refactor * refactor string generators * bring back writeAndroidManifest * update overrideVersionCode javadoc * update overrideVersionCode javadoc * move dependency to extension source * refactor runAllGenerators * improve docs * remove extra file
2021-02-06 22:32:04 +00:00
2022-06-05 00:55:39 +00:00
- name: Build extensions (chunk ${{ matrix.chunk }})
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 }}
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 }})
uses: actions/upload-artifact@v3
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 }}"
path: "**/*.apk"
2021-06-20 21:45:22 +00:00
retention-days: 1
- 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
uses: actions/checkout@v4
2021-06-20 21:45:22 +00:00
- name: Set up JDK
2022-05-15 17:56:52 +00:00
uses: actions/setup-java@v3
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
- name: Prepare signing key
2021-06-20 21:45:22 +00:00
run: |
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 }})
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 }}
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 }})
uses: actions/upload-artifact@v3
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 }}"
path: "**/*.apk"
2021-06-20 21:45:22 +00:00
retention-days: 1
- 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
uses: actions/download-artifact@v3
2021-06-20 21:45:22 +00:00
with:
path: ~/apk-artifacts
2021-06-20 21:45:22 +00:00
- name: Set up JDK
2022-05-15 17:56:52 +00:00
uses: actions/setup-java@v3
with:
2023-09-03 17:34:30 +00:00
java-version: 17
2022-05-15 17:56:52 +00:00
distribution: adopt
- name: Checkout master branch
uses: actions/checkout@v4
with:
ref: master
path: master
- name: Create repo artifacts
run: |
cd master
./.github/scripts/move-apks.sh
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"
2020-11-13 00:22:02 +00:00
./.github/scripts/create-repo.sh
- name: Checkout repo branch
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