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

165 lines
4.6 KiB
YAML

name: CI
on:
push:
branches:
- master
paths-ignore:
- '**.md'
jobs:
check_wrapper:
name: Validate Gradle Wrapper
runs-on: ubuntu-latest
steps:
- name: Cancel previous runs
uses: styfle/cancel-workflow-action@0.9.1
with:
access_token: ${{ github.token }}
all_but_latest: true
- name: Clone repo
uses: actions/checkout@v2
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
build_multisrc:
name: Build multisrc modules
needs: check_wrapper
runs-on: ubuntu-latest
strategy:
matrix:
lang: [all, en, ar, ca, de, es, fr, id, it, ja, ko, pt, ru, th, tr, vi, zh, bg, hi, pl]
steps:
- name: Checkout master branch
uses: actions/checkout@v2
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Copy CI files
run: |
mkdir -p ~/.gradle
cp .github/runner-files/ci-gradle.properties ~/.gradle/gradle.properties
echo ${{ secrets.SIGNING_KEY }} | base64 -d > signingkey.jks
- name: Generate sources from the multi-source library
uses: gradle/gradle-command-action@v2
env:
CI_MULTISRC: "true"
with:
arguments: :multisrc:generateExtensions
- name: Build "${{ matrix.lang }}" extensions
uses: gradle/gradle-command-action@v2
env:
CI_MULTISRC: "true"
CI_MATRIX_LANG: ${{ matrix.lang }}
ALIAS: ${{ secrets.ALIAS }}
KEY_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
with:
arguments: assembleRelease
- name: Upload "${{ matrix.lang }}" APKs
uses: actions/upload-artifact@v2
if: "github.repository == 'tachiyomiorg/tachiyomi-extensions'"
with:
name: "multisrc-${{ matrix.lang }}-apks"
path: "**/*.apk"
retention-days: 1
- name: Clean up CI files
run: rm signingkey.jks
build_individual:
name: Build individual modules
needs: check_wrapper
runs-on: ubuntu-latest
strategy:
matrix:
lang: [all, en, ar, ca, de, es, fr, id, it, ja, ko, pt, ru, th, tr, vi, zh, bg, hi, pl]
steps:
- name: Checkout master branch
uses: actions/checkout@v2
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Copy CI files
run: |
mkdir -p ~/.gradle
cp .github/runner-files/ci-gradle.properties ~/.gradle/gradle.properties
echo ${{ secrets.SIGNING_KEY }} | base64 -d > signingkey.jks
- name: Build "${{ matrix.lang }}" extensions
uses: gradle/gradle-command-action@v2
env:
CI_MULTISRC: "false"
CI_MATRIX_LANG: ${{ matrix.lang }}
ALIAS: ${{ secrets.ALIAS }}
KEY_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
with:
arguments: assembleRelease
- name: Upload "${{ matrix.lang }}" APKs
uses: actions/upload-artifact@v2
if: "github.repository == 'tachiyomiorg/tachiyomi-extensions'"
with:
name: "individual-${{ matrix.lang }}-apks"
path: "**/*.apk"
retention-days: 1
- name: Clean up CI files
run: rm signingkey.jks
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@v2
with:
path: ~/apk-artifacts
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 11
- name: Checkout master branch
uses: actions/checkout@v2
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"
./.github/scripts/create-repo.sh
- name: Checkout repo branch
uses: actions/checkout@v2
with:
ref: repo
path: repo
- name: Deploy repo
run: |
cd repo
../master/.github/scripts/commit-repo.sh