Asura Scans: support high quality chapter images (#6657) #2135
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- '**' | |
- '!**.md' | |
- '!.github/**' | |
- '.github/scripts/**' | |
- '.github/workflows/build_push.yml' | |
concurrency: | |
group: ${{ github.workflow }} | |
cancel-in-progress: true | |
env: | |
CI_CHUNK_SIZE: 65 | |
jobs: | |
prepare: | |
name: Prepare job | |
runs-on: ubuntu-latest | |
outputs: | |
individualMatrix: ${{ steps.generate-matrices.outputs.individualMatrix }} | |
steps: | |
- name: Clone repo | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Validate Gradle Wrapper | |
uses: gradle/actions/wrapper-validation@cc4fc85e6b35bafd578d5ffbc76a5518407e1af0 # v4.2.1 | |
- name: Get number of modules | |
run: | | |
set -x | |
projects=(src/*/*) | |
echo "NUM_INDIVIDUAL_MODULES=${#projects[@]}" >> $GITHUB_ENV | |
- id: generate-matrices | |
name: Create output matrices | |
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 | |
with: | |
script: | | |
const numIndividualModules = process.env.NUM_INDIVIDUAL_MODULES; | |
const chunkSize = process.env.CI_CHUNK_SIZE; | |
const numIndividualChunks = Math.ceil(numIndividualModules / chunkSize); | |
console.log(`Individual modules: ${numIndividualModules} (${numIndividualChunks} chunks of ${chunkSize})`); | |
core.setOutput('individualMatrix', { 'chunk': [...Array(numIndividualChunks).keys()] }); | |
build_individual: | |
name: Build individual modules | |
needs: prepare | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: ${{ fromJSON(needs.prepare.outputs.individualMatrix) }} | |
steps: | |
- name: Checkout main branch | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Set up JDK | |
uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4.5.0 | |
with: | |
java-version: 17 | |
distribution: temurin | |
- name: Prepare signing key | |
run: | | |
echo ${{ secrets.SIGNING_KEY }} | base64 -d > signingkey.jks | |
- name: Set up Gradle | |
uses: gradle/actions/setup-gradle@cc4fc85e6b35bafd578d5ffbc76a5518407e1af0 # v4.2.1 | |
with: | |
cache-read-only: ${{ matrix.chunk != 0 }} | |
- name: Build extensions (chunk ${{ matrix.chunk }}) | |
env: | |
CI_CHUNK_NUM: ${{ matrix.chunk }} | |
ALIAS: ${{ secrets.ALIAS }} | |
KEY_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }} | |
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} | |
run: ./gradlew -p src assembleRelease | |
- name: Upload APKs (chunk ${{ matrix.chunk }}) | |
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 | |
if: "github.repository == 'keiyoushi/extensions-source'" | |
with: | |
name: "individual-apks-${{ matrix.chunk }}" | |
path: "**/*.apk" | |
retention-days: 1 | |
- name: Clean up CI files | |
run: rm signingkey.jks | |
publish_repo: | |
name: Publish repo | |
needs: | |
- build_individual | |
if: "github.repository == 'keiyoushi/extensions-source'" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download APK artifacts | |
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | |
with: | |
path: ~/apk-artifacts | |
- name: Set up JDK | |
uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4.5.0 | |
with: | |
java-version: 17 | |
distribution: temurin | |
- name: Checkout main branch | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
ref: main | |
path: main | |
- name: Create repo artifacts | |
run: | | |
cd main | |
python ./.github/scripts/move-apks.py | |
INSPECTOR_LINK="$(curl -s "https://api.github.com/repos/keiyoushi/extensions-inspector/releases/latest" | jq -r '.assets[0].browser_download_url')" | |
curl -L "$INSPECTOR_LINK" -o ./Inspector.jar | |
java -jar ./Inspector.jar "repo/apk" "output.json" "tmp" | |
python ./.github/scripts/create-repo.py | |
- name: Checkout repo branch | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
repository: keiyoushi/extensions | |
token: ${{ secrets.BOT_PAT }} | |
ref: repo | |
path: repo | |
- name: Deploy repo | |
run: | | |
cd repo | |
../main/.github/scripts/commit-repo.sh |