Downgrade jdk #17
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: | |
- master | |
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@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
with: | |
ref: master | |
token: ${{ secrets.ANIYOMIORG_BOT_PAT }} | |
- name: Validate Gradle Wrapper | |
uses: gradle/actions/wrapper-validation@dbbdc275be76ac10734476cc723d82dfe7ec6eda # v3.4.2 | |
- name: Find lib changes | |
id: modified-libs | |
uses: tj-actions/changed-files@cc733854b1f224978ef800d29e4709d5ee2883e4 #v44.5.5 | |
with: | |
files: lib/ | |
files_ignore: lib/**.md | |
files_separator: " " | |
safe_output: false | |
# This step is going to commit, but this will not trigger another workflow. | |
- name: Bump extensions that uses a modified lib | |
if: steps.modified-libs.outputs.any_changed == 'true' | |
run: | | |
./.github/scripts/bump-versions.py ${{ steps.modified-libs.outputs.all_changed_files }} | |
- name: Validate Gradle Wrapper | |
uses: gradle/wrapper-validation-action@a494d935f4b56874c4a5a87d19af7afcf3a163d0 # v2 | |
- 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 | |
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 master branch | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
with: | |
ref: master | |
- name: Set up JDK | |
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1 | |
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@dbbdc275be76ac10734476cc723d82dfe7ec6eda # v3.4.2 | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- 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@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 | |
if: "github.repository == 'Secozzi/aniyomi-extensions'" | |
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 == 'Secozzi/aniyomi-extensions'" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download APK artifacts | |
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 | |
with: | |
path: ~/apk-artifacts | |
- name: Set up JDK | |
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1 | |
with: | |
java-version: 17 | |
distribution: temurin | |
- name: Checkout master branch | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
with: | |
ref: master | |
path: master | |
- name: Create repo artifacts | |
run: | | |
cd master | |
python ./.github/scripts/move-apks.py | |
INSPECTOR_LINK="$(curl -s "https://api.github.com/repos/Secozzi/aniyomi-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@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
with: | |
repository: Secozzi/aniyomi-extensions | |
token: ${{ secrets.ANIYOMIORG_BOT_PAT }} | |
ref: repo | |
path: repo | |
- name: Deploy repo | |
run: | | |
cd repo | |
chmod +x ../master/.github/scripts/commit-repo.sh | |
../master/.github/scripts/commit-repo.sh |