Overhaul 2025 (See PR for changes)
This commit is contained in:
171
.github/workflows/build_push.yml
vendored
171
.github/workflows/build_push.yml
vendored
@@ -3,10 +3,16 @@ name: CI
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
# - main
|
||||
- master
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
- '.github/workflows/issue_moderator.yml'
|
||||
paths:
|
||||
- '**'
|
||||
- '!**.md'
|
||||
- '!.github/**'
|
||||
- '.github/scripts/**'
|
||||
- '.github/workflows/build_push.yml'
|
||||
# Manual trigger
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}
|
||||
@@ -14,132 +20,149 @@ concurrency:
|
||||
|
||||
env:
|
||||
CI_CHUNK_SIZE: 65
|
||||
IS_PR_CHECK: false
|
||||
|
||||
jobs:
|
||||
prepare:
|
||||
name: Prepare job
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: 'ubuntu-24.04'
|
||||
outputs:
|
||||
individualMatrix: ${{ steps.generate-matrices.outputs.individualMatrix }}
|
||||
env:
|
||||
CI_MODULE_GEN: true
|
||||
latestCommitMessage: ${{ steps.set-env.outputs.LATEST_COMMIT_MESSAGE }}
|
||||
matrix: ${{ steps.generate-matrices.outputs.matrix }}
|
||||
delete: ${{ steps.generate-matrices.outputs.delete }}
|
||||
steps:
|
||||
- name: Clone repo
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Validate Gradle Wrapper
|
||||
uses: gradle/wrapper-validation-action@v1
|
||||
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v4
|
||||
- name: Checkout ${{ github.ref_name }} branch
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
java-version: 11
|
||||
distribution: adopt
|
||||
fetch-depth: 0
|
||||
|
||||
|
||||
- name: Get number of modules
|
||||
- name: Set env
|
||||
id: set-env
|
||||
run: |
|
||||
set -x
|
||||
./gradlew -q projects | grep '.*extensions\:\(individual\)\:.*\:.*' > projects.txt
|
||||
echo "LATEST_COMMIT_MESSAGE<<{delimiter}
|
||||
$(git log -1 --pretty=%B)
|
||||
{delimiter}" >> $GITHUB_OUTPUT
|
||||
|
||||
echo "NUM_INDIVIDUAL_MODULES=$(cat projects.txt | grep '.*\:individual\:.*' | wc -l)" >> $GITHUB_ENV
|
||||
- name: Set up Java
|
||||
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
|
||||
with:
|
||||
java-version: 17
|
||||
distribution: temurin
|
||||
|
||||
- name: Set up Gradle
|
||||
uses: gradle/actions/setup-gradle@06832c7b30a0129d7fb559bcc6e43d26f6374244 # v4.3.1
|
||||
with:
|
||||
cache-read-only: true
|
||||
|
||||
- name: Get last successful CI commit
|
||||
id: last_successful_ci_commit
|
||||
uses: nrwl/nx-set-shas@dbe0650947e5f2c81f59190a38512cf49126fe6b # v4.3.0
|
||||
with:
|
||||
main-branch-name: ${{ github.ref_name }}
|
||||
|
||||
- id: generate-matrices
|
||||
name: Create output matrices
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
const numIndividualModules = process.env.NUM_INDIVIDUAL_MODULES;
|
||||
const chunkSize = process.env.CI_CHUNK_SIZE;
|
||||
run: |
|
||||
python ./.github/scripts/generate-build-matrices.py ${{ steps.last_successful_ci_commit.outputs.base }} Release
|
||||
|
||||
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
|
||||
build:
|
||||
name: Build extensions (${{ matrix.chunk.number }})
|
||||
needs: prepare
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: 'ubuntu-24.04'
|
||||
if: ${{ toJson(fromJson(needs.prepare.outputs.matrix).chunk) != '[]' }}
|
||||
strategy:
|
||||
matrix: ${{ fromJSON(needs.prepare.outputs.individualMatrix) }}
|
||||
matrix: ${{ fromJSON(needs.prepare.outputs.matrix) }}
|
||||
steps:
|
||||
- name: Checkout master branch
|
||||
uses: actions/checkout@v4
|
||||
- name: Checkout ${{ github.ref_name }} branch
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v4
|
||||
- name: Set up Java
|
||||
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
|
||||
with:
|
||||
java-version: 11
|
||||
distribution: adopt
|
||||
java-version: 17
|
||||
distribution: temurin
|
||||
|
||||
- name: Set up Gradle
|
||||
uses: gradle/actions/setup-gradle@06832c7b30a0129d7fb559bcc6e43d26f6374244 # v4.3.1
|
||||
with:
|
||||
cache-read-only: ${{ matrix.chunk.number > 1 }}
|
||||
|
||||
- name: Prepare signing key
|
||||
run: |
|
||||
echo ${{ secrets.SIGNING_KEY }} | base64 -d > signingkey.jks
|
||||
|
||||
- name: Build extensions (chunk ${{ matrix.chunk }})
|
||||
uses: gradle/gradle-build-action@v2
|
||||
- name: Build extensions (${{ matrix.chunk.number }})
|
||||
env:
|
||||
CI_MULTISRC: "false"
|
||||
CI_CHUNK_NUM: ${{ matrix.chunk }}
|
||||
ALIAS: ${{ secrets.ALIAS }}
|
||||
KEY_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }}
|
||||
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
|
||||
with:
|
||||
arguments: assembleRelease
|
||||
run: |
|
||||
./gradlew $(echo '${{ toJson(matrix.chunk.modules) }}' | jq -r 'join(" ")')
|
||||
|
||||
- name: Upload APKs (chunk ${{ matrix.chunk }})
|
||||
uses: actions/upload-artifact@v4
|
||||
if: "github.repository == 'Kareadita/tach-extension'"
|
||||
- name: Upload APKs (${{ matrix.chunk.number }})
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||
if: github.repository == 'Kareadita/tach-extension'
|
||||
with:
|
||||
name: "individual-apks-${{ matrix.chunk }}"
|
||||
name: "individual-apks-${{ matrix.chunk.number }}"
|
||||
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 == 'Kareadita/tach-extension'"
|
||||
runs-on: ubuntu-latest
|
||||
publish:
|
||||
name: Publish extension repo
|
||||
needs: [prepare, build]
|
||||
if: github.repository == 'Kareadita/tach-extension'
|
||||
runs-on: 'ubuntu-24.04'
|
||||
steps:
|
||||
- name: Download APK artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
|
||||
with:
|
||||
path: ~/apk-artifacts
|
||||
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v4
|
||||
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
|
||||
with:
|
||||
java-version: 17
|
||||
distribution: adopt
|
||||
distribution: temurin
|
||||
|
||||
- name: Checkout master branch
|
||||
uses: actions/checkout@v4
|
||||
- name: Checkout ${{ github.ref_name }} branch
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
ref: master
|
||||
path: master
|
||||
ref: ${{ github.ref_name }}
|
||||
path: ${{ github.ref_name }}
|
||||
|
||||
- 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')"
|
||||
cd ${{ github.ref_name }}
|
||||
python ./.github/scripts/move-built-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 "apk" "output.json" "tmp"
|
||||
./.github/scripts/create-repo.sh
|
||||
java -jar ./Inspector.jar "repo/apk" "output.json" "tmp"
|
||||
python ./.github/scripts/create-repo.py
|
||||
|
||||
- name: Checkout repo branch
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
repository: yuzono/manga-repo
|
||||
token: ${{ secrets.BOT_PAT }}
|
||||
ref: repo
|
||||
path: repo
|
||||
|
||||
- name: Deploy repo
|
||||
- name: Merge repo
|
||||
run: |
|
||||
cd repo
|
||||
../master/.github/scripts/commit-repo.sh
|
||||
python ../${{ github.ref_name }}/.github/scripts/merge-repo.py '${{ needs.prepare.outputs.delete }}' '${{ github.ref_name }}/repo'
|
||||
|
||||
- name: Deploy repo
|
||||
uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9
|
||||
with:
|
||||
message: "${{ needs.prepare.outputs.latestCommitMessage }}"
|
||||
cwd: "./repo"
|
||||
committer_name: github-actions[bot]
|
||||
committer_email: github-actions[bot]@users.noreply.github.com
|
||||
|
||||
- name: Purge cached index on jsDelivr
|
||||
run: |
|
||||
curl https://purge.jsdelivr.net/gh/Kareadita/tach-extension@repo/index.min.json
|
||||
|
||||
Reference in New Issue
Block a user