Initial commit

This commit is contained in:
almightyhak 2024-06-20 11:54:12 +07:00
commit 98ed7e8839
2263 changed files with 108711 additions and 0 deletions

32
.github/ISSUE_TEMPLATE.md vendored Normal file
View file

@ -0,0 +1,32 @@
**PLEASE READ THIS**
I acknowledge that:
- I have updated to the latest version of the app (stable is v0.15.2.2)
- I have updated all extensions
- If this is an issue with the app itself, that I should be opening an issue in https://github.com/aniyomiorg/aniyomi
- I have searched the existing issues for duplicates
- For source requests, I have checked the list of existing extensions including the multi-source spreadsheet: https://aniyomi.org/extensions/
**DELETE THIS SECTION IF YOU HAVE READ AND ACKNOWLEDGED IT**
---
## Device information
* Aniyomi version: ?
* Android version: ?
* Device: ?
## Source information
* Source name: ?
* Source extension version: ?
## Steps to reproduce
1. First step
2. Second step
## Issue/Request
?
## Other details
Additional details and attachments.

View file

@ -0,0 +1,107 @@
name: 🐞 Issue report
description: Report a source issue in Aniyomi
labels: [Bug]
body:
- type: input
id: source
attributes:
label: Source information
description: |
You can find the extension name and version in **Browse → Extensions**.
placeholder: |
Example: "AnimePahe 14.19 (English)"
validations:
required: true
- type: input
id: language
attributes:
label: Source language
placeholder: |
Example: "English"
validations:
required: true
- type: textarea
id: reproduce-steps
attributes:
label: Steps to reproduce
description: Provide an example of the issue. Be as specific as possible.
placeholder: |
Example:
1. First step (e.g. "Open Mahouka Koukou No Rettousei (first season)")
2. Second step (e.g. "Try to watch episode 15")
3. Issue here (e.g. "It shows a HTTP 403 error toast")
validations:
required: true
- type: textarea
id: expected-behavior
attributes:
label: Expected behavior
placeholder: |
Example:
"This should happen..."
validations:
required: true
- type: textarea
id: actual-behavior
attributes:
label: Actual behavior
placeholder: |
Example:
"This happened instead..."
validations:
required: true
- type: input
id: aniyomi-version
attributes:
label: Aniyomi version
description: |
You can find your Aniyomi version in **More → About**.
placeholder: |
Example: "0.15.2.4" or "Preview r7473"
validations:
required: true
- type: input
id: android-version
attributes:
label: Android version
description: |
You can find this somewhere in your Android settings.
placeholder: |
Example: "Android 11"
validations:
required: true
- type: textarea
id: other-details
attributes:
label: Other details
placeholder: |
Additional details and attachments.
- type: checkboxes
id: acknowledgements
attributes:
label: Acknowledgements
description: Your issue will be closed if you haven't done these steps.
options:
- label: I have searched the existing issues and this is a new ticket, **NOT** a duplicate or related to another open or closed issue.
required: true
- label: I have written a short but informative title.
required: true
- label: I have updated the app to version **[0.15.2.4](https://github.com/aniyomiorg/aniyomi/releases/latest)**.
required: true
- label: I have updated all installed extensions.
required: true
- label: I have tried the [troubleshooting guide](https://aniyomi.org/docs/guides/troubleshooting/).
required: true
- label: If this is an issue with the app itself, I should be opening an issue in the [app repository](https://github.com/aniyomiorg/aniyomi/issues/new/choose).
required: true
- label: I will fill out all of the requested information in this form.
required: true

View file

@ -0,0 +1,56 @@
name: 🌐 Source request
description: Suggest a new source for Aniyomi
labels: [Source request]
body:
- type: input
id: name
attributes:
label: Source name
placeholder: |
Example: "Not Real Source"
validations:
required: true
- type: input
id: link
attributes:
label: Source link
placeholder: |
Example: "https://notrealsource.org"
validations:
required: true
- type: input
id: language
attributes:
label: Source language
placeholder: |
Example: "English"
validations:
required: true
- type: textarea
id: other-details
attributes:
label: Other details
placeholder: |
Additional details and attachments.
Example: "+18/NSFW = yes"
- type: checkboxes
id: acknowledgements
attributes:
label: Acknowledgements
description: Your issue will be closed if you haven't done these steps.
options:
- label: I have searched the existing issues and this is a new ticket, **NOT** a duplicate or related to another open or closed issue.
required: true
- label: I have written a title with source name.
required: true
- label: I have checked that the extension does not already exist on the [website extensions list](https://aniyomi.org/extensions/) or the app.
required: true
- label: I have checked that the extension does not already exist by searching the [GitHub repository](https://github.com/aniyomiorg/aniyomi-extensions/) and verified it does not appear in the code base.
required: true
- label: I will fill out all of the requested information in this form.
required: true

View file

@ -0,0 +1,57 @@
name: 🔗 URL change report
description: Report URL change of an existing source
labels: [Bug,Domain changed]
body:
- type: input
id: source
attributes:
label: Source information
description: |
You can find the extension name and version in **Browse → Extensions**.
placeholder: |
Example: "NotRealSource 14.1"
validations:
required: true
- type: input
id: language
attributes:
label: Source language
placeholder: |
Example: "English"
validations:
required: true
- type: input
id: link
attributes:
label: Source new URL
placeholder: |
Example: "https://notrealsource.org"
validations:
required: true
- type: textarea
id: other-details
attributes:
label: Other details
placeholder: |
Additional details and attachments.
- type: checkboxes
id: acknowledgements
attributes:
label: Acknowledgements
description: Your issue will be closed if you haven't done these steps.
options:
- label: I have searched the existing issues and this is a new ticket, **NOT** a duplicate or related to another open or closed issue.
required: true
- label: I have written a short but informative title.
required: true
- label: I have updated all installed extensions.
required: true
- label: I have opened WebView and checked that the source URL is not updated yet.
required: true
- label: I will fill out all of the requested information in this form.
required: true

View file

@ -0,0 +1,63 @@
name: ❌ Dead source report
description: Source is down and website is closed
labels: [Source is down]
body:
- type: markdown
attributes:
value: |
### Notice
If you have a lot of dead sources to report, please go back and submit a single meta request.
- type: input
id: source
attributes:
label: Source name
description: |
You can find the extension name in **Browse → Extensions**.
placeholder: |
Example: "NotRealSource"
validations:
required: true
- type: input
id: language
attributes:
label: Source language
placeholder: |
Example: "English"
validations:
required: true
- type: input
id: link
attributes:
label: Source link
placeholder: |
Example: "https://notrealsource.org"
validations:
required: true
- type: textarea
id: other-details
attributes:
label: Other details
placeholder: |
Additional details and attachments.
- type: checkboxes
id: acknowledgements
attributes:
label: Acknowledgements
description: Your issue will be closed if you haven't done these steps.
options:
- label: I have searched the existing issues and this is a new ticket, **NOT** a duplicate or related to another open or closed issue.
required: true
- label: I have written a title with source name.
required: true
- label: I have updated all installed extensions.
required: true
- label: I have opened WebView and checked that the source website is down.
required: true
- label: I will fill out all of the requested information in this form.
required: true

View file

@ -0,0 +1,59 @@
name: ⭐ Feature request
description: Suggest a feature to improve an existing source
labels: [Feature request]
body:
- type: input
id: source
attributes:
label: Source name
description: |
You can find the extension name in **Browse → Extensions**.
placeholder: |
Example: "DopeBox"
validations:
required: true
- type: input
id: language
attributes:
label: Source language
placeholder: |
Example: "English"
validations:
required: true
- type: textarea
id: feature-description
attributes:
label: Describe your suggested feature
description: How can an existing extension be improved?
placeholder: |
Example:
"It should work like this..."
validations:
required: true
- type: textarea
id: other-details
attributes:
label: Other details
placeholder: |
Additional details and attachments.
- type: checkboxes
id: acknowledgements
attributes:
label: Acknowledgements
description: Your issue will be closed if you haven't done these steps.
options:
- label: I have searched the existing issues and this is a new ticket, **NOT** a duplicate or related to another open or closed issue.
required: true
- label: I have written a short but informative title.
required: true
- label: If this is an issue with the app itself, I should be opening an issue in the [app repository](https://github.com/aniyomiorg/aniyomi/issues/new/choose).
required: true
- label: I have updated the app to version **[0.15.2.4](https://github.com/aniyomiorg/aniyomi/releases/latest)**.
required: true
- label: I will fill out all of the requested information in this form.
required: true

View file

@ -0,0 +1,41 @@
name: 🧠 Meta request
description: Suggest improvements to the project
labels: [Meta request]
body:
- type: textarea
id: feature-description
attributes:
label: Describe why this should be added
description: How can the project be improved?
placeholder: |
Example:
"It should work like this..."
validations:
required: true
- type: textarea
id: other-details
attributes:
label: Other details
placeholder: |
Additional details and attachments.
- type: checkboxes
id: acknowledgements
attributes:
label: Acknowledgements
description: Your issue will be closed if you haven't done these steps.
options:
- label: I have searched the existing issues and this is a new ticket, **NOT** a duplicate or related to another open (or closed) issue.
required: true
- label: I have written a short but informative title.
required: true
- label: If this is an issue with the app itself, I should be opening an issue in the [app repository](https://github.com/aniyomiorg/aniyomi/issues/new/choose).
required: true
- label: I have updated the app to version **[0.15.2.4](https://github.com/aniyomiorg/aniyomi/releases/latest)**.
required: true
- label: I have updated all installed extensions.
required: true
- label: I will fill out all of the requested information in this form.
required: true

View file

@ -0,0 +1,33 @@
name: 🗑 Source removal request
description: Scanlators can request their site to be removed
labels: [Meta request]
body:
- type: input
id: link
attributes:
label: Source link
placeholder: |
Example: "https://notrealscans.org"
validations:
required: true
- type: textarea
id: other-details
attributes:
label: Other details
placeholder: |
Additional details and attachments.
- type: checkboxes
id: requirements
attributes:
label: Requirements
description: Your request will be denied if you don't meet these requirements.
options:
- label: Proof of ownership/intent to remove sent to a Aniyomi Discord server mod via DM
required: true
- label: Site only hosts content scanlated by the group and not stolen from other scanlators or official releases (i.e., not an aggregator site)
required: true
- label: Site is not infested with user-hostile features (e.g., invasive or malicious ads)
required: true

14
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View file

@ -0,0 +1,14 @@
blank_issues_enabled: false
contact_links:
- name: ⚠️ Application issue
url: https://github.com/aniyomiorg/aniyomi/issues/new/choose
about: Issues and requests about the app itself should be opened in the tachiyomi repository instead
- name: 📦 Aniyomi extensions
url: https://aniyomi.org/extensions
about: List of all available extensions with download links
- name: 🖥️ Aniyomi website
url: https://aniyomi.org/help/
about: Guides, troubleshooting, and answers to common questions
- name: Aniyomi app GitHub repository
url: https://github.com/aniyomiorg/aniyomi
about: Issues about the app itself should be opened here instead.

10
.github/pull_request_template.md vendored Normal file
View file

@ -0,0 +1,10 @@
Checklist:
- [ ] Updated `extVersionCode` value in `build.gradle` for individual extensions
- [ ] Updated `overrideVersionCode` or `baseVersionCode` as needed for all multisrc extensions
- [ ] Referenced all related issues in the PR body (e.g. "Closes #xyz")
- [ ] Added the `isNsfw = true` flag in `build.gradle` when appropriate
- [ ] Have not changed source names
- [ ] Have explicitly kept the `id` if a source's name or language were changed
- [ ] Have tested the modifications by compiling and running the extension through Android Studio
- [ ] Have removed `web_hi_res_512.png` when adding a new extension

BIN
.github/readme-images/app-icon.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

75
.github/scripts/bump-versions.py vendored Normal file
View file

@ -0,0 +1,75 @@
#!/usr/bin/env python3
from concurrent.futures import Future, ThreadPoolExecutor, as_completed
import itertools
from pathlib import Path
import re
import subprocess
import sys
VERSION_STR = "VersionCode ="
VERSION_REGEX = re.compile(f"{VERSION_STR} (\\d+)")
BUMPED_FILES: list[Path] = []
BOT_EMAIL = "aniyomi-bot@aniyomi.org"
BOT_NAME = "aniyomi-bot[bot]"
def has_match(query: str, file: Path) -> tuple[Path, bool]:
return (file, query in file.read_text())
def find_files_with_match(query: str, include_multisrc: bool = True) -> list[Path]:
files = Path("src").glob("*/*/build.gradle")
if include_multisrc:
files = itertools.chain(files, Path("lib-multisrc").glob("*/build.gradle.kts"))
# Prevent bumping files twice.
files = filter(lambda file: file not in BUMPED_FILES, files)
# Use multiple threads to find matches.
with ThreadPoolExecutor() as executor:
futures = [executor.submit(has_match, query, file) for file in files]
results = map(Future.result, as_completed(futures))
return [path for path, result in results if result]
def replace_version(match: re.Match) -> str:
version = int(match.group(1))
print(f"{version} -> {version + 1}")
return f"{VERSION_STR} {version + 1}"
def bump_version(file: Path):
BUMPED_FILES.append(file)
with file.open("r+") as f:
print(f"\n{file}: ", end="")
text = VERSION_REGEX.sub(replace_version, f.read())
# Move the cursor to the start again, to prevent writing at the end
f.seek(0)
f.write(text)
def bump_lib_multisrc(theme: str):
for file in find_files_with_match(f"themePkg = '{theme}'", include_multisrc=False):
bump_version(file)
def commit_changes():
paths = [str(path.resolve()) for path in BUMPED_FILES]
subprocess.check_call(["git", "config", "--local", "user.email", BOT_EMAIL])
subprocess.check_call(["git", "config", "--local", "user.name", BOT_NAME])
subprocess.check_call(["git", "add"] + paths)
subprocess.check_call(["git", "commit", "-S", "-m", "[skip ci] chore: Mass-bump on extensions"])
subprocess.check_call(["git", "push"])
if __name__ == "__main__":
if len(sys.argv) > 1:
# Regex to match the lib name in the path, like "unpacker" or "dood-extractor".
lib_regex = re.compile(r"lib/([a-z0-9-]+)/")
# Find matches and remove None results.
matches = filter(None, map(lib_regex.search, sys.argv[1:]))
for match in matches:
project_path = ":lib:" + match.group(1)
for file in find_files_with_match(project_path):
if file.parent.parent.name == "lib-multisrc":
bump_lib_multisrc(file.parent.name)
else:
bump_version(file)
if len(BUMPED_FILES) > 0:
commit_changes()

17
.github/scripts/commit-repo.sh vendored Normal file
View file

@ -0,0 +1,17 @@
#!/bin/bash
set -e
rsync -a --delete --exclude .git --exclude .gitignore ../master/repo/ .
git config --global user.email "aniyomi-bot@aniyomi.org"
git config --global user.name "aniyomi-bot[bot]"
git status
if [ -n "$(git status --porcelain)" ]; then
git add .
git commit -S -m "Update extensions repo"
git push
# Purge cached index on jsDelivr
curl https://purge.jsdelivr.net/gh/aniyomiorg/aniyomi-extensions@repo/index.min.json
else
echo "No changes to commit"
fi

108
.github/scripts/create-repo.py vendored Normal file
View file

@ -0,0 +1,108 @@
import json
import os
import re
import subprocess
from pathlib import Path
from zipfile import ZipFile
PACKAGE_NAME_REGEX = re.compile(r"package: name='([^']+)'")
VERSION_CODE_REGEX = re.compile(r"versionCode='([^']+)'")
VERSION_NAME_REGEX = re.compile(r"versionName='([^']+)'")
IS_NSFW_REGEX = re.compile(r"'tachiyomi.animeextension.nsfw' value='([^']+)'")
APPLICATION_LABEL_REGEX = re.compile(r"^application-label:'([^']+)'", re.MULTILINE)
APPLICATION_ICON_320_REGEX = re.compile(
r"^application-icon-320:'([^']+)'", re.MULTILINE
)
LANGUAGE_REGEX = re.compile(r"aniyomi-([^\.]+)")
*_, ANDROID_BUILD_TOOLS = (Path(os.environ["ANDROID_HOME"]) / "build-tools").iterdir()
REPO_DIR = Path("repo")
REPO_APK_DIR = REPO_DIR / "apk"
REPO_ICON_DIR = REPO_DIR / "icon"
REPO_ICON_DIR.mkdir(parents=True, exist_ok=True)
with open("output.json", encoding="utf-8") as f:
inspector_data = json.load(f)
index_data = []
index_min_data = []
for apk in REPO_APK_DIR.iterdir():
badging = subprocess.check_output(
[
ANDROID_BUILD_TOOLS / "aapt",
"dump",
"--include-meta-data",
"badging",
apk,
]
).decode()
package_info = next(x for x in badging.splitlines() if x.startswith("package: "))
package_name = PACKAGE_NAME_REGEX.search(package_info).group(1)
application_icon = APPLICATION_ICON_320_REGEX.search(badging).group(1)
with ZipFile(apk) as z, z.open(application_icon) as i, (
REPO_ICON_DIR / f"{package_name}.png"
).open("wb") as f:
f.write(i.read())
language = LANGUAGE_REGEX.search(apk.name).group(1)
sources = inspector_data[package_name]
if len(sources) == 1:
source_language = sources[0]["lang"]
if (
source_language != language
and source_language not in {"all", "other"}
and language not in {"all", "other"}
):
language = source_language
common_data = {
"name": APPLICATION_LABEL_REGEX.search(badging).group(1),
"pkg": package_name,
"apk": apk.name,
"lang": language,
"code": int(VERSION_CODE_REGEX.search(package_info).group(1)),
"version": VERSION_NAME_REGEX.search(package_info).group(1),
"nsfw": int(IS_NSFW_REGEX.search(badging).group(1)),
}
min_data = {
**common_data,
"sources": [],
}
for source in sources:
min_data["sources"].append(
{
"name": source["name"],
"lang": source["lang"],
"id": source["id"],
"baseUrl": source["baseUrl"],
}
)
index_min_data.append(min_data)
index_data.append(
{
**common_data,
"hasReadme": 0,
"hasChangelog": 0,
"sources": sources,
}
)
index_data.sort(key=lambda x: x["pkg"])
index_min_data.sort(key=lambda x: x["pkg"])
with (REPO_DIR / "index.json").open("w", encoding="utf-8") as f:
index_data_str = json.dumps(index_data, ensure_ascii=False, indent=2)
print(index_data_str)
f.write(index_data_str)
with (REPO_DIR / "index.min.json").open("w", encoding="utf-8") as f:
json.dump(index_min_data, f, ensure_ascii=False, separators=(",", ":"))

16
.github/scripts/move-apks.py vendored Normal file
View file

@ -0,0 +1,16 @@
from pathlib import Path
import shutil
REPO_APK_DIR = Path("repo/apk")
try:
shutil.rmtree(REPO_APK_DIR)
except FileNotFoundError:
pass
REPO_APK_DIR.mkdir(parents=True, exist_ok=True)
for apk in (Path.home() / "apk-artifacts").glob("**/*.apk"):
apk_name = apk.name.replace("-release.apk", ".apk")
shutil.move(apk, REPO_APK_DIR / apk_name)

52
.github/scripts/sign-apks.sh vendored Normal file
View file

@ -0,0 +1,52 @@
#!/bin/bash
set -e
TOOLS="$(ls -d ${ANDROID_HOME}/build-tools/* | tail -1)"
shopt -s globstar nullglob extglob
APKS=( **/*".apk" )
# Fail if too little extensions seem to have been built
if [ "${#APKS[@]}" -le "50" ]; then
echo "Insufficient amount of APKs found. Please check the project configuration."
exit 1;
fi;
# Take base64 encoded key input and put it into a file
STORE_PATH=$PWD/signingkey.jks
rm -f $STORE_PATH && touch $STORE_PATH
echo $1 | base64 -d > $STORE_PATH
STORE_ALIAS=$2
export KEY_STORE_PASSWORD=$3
export KEY_PASSWORD=$4
DEST=$PWD/apk
rm -rf $DEST && mkdir -p $DEST
MAX_PARALLEL=4
# Sign all of the APKs
for APK in ${APKS[@]}; do
(
BASENAME=$(basename $APK)
APKNAME="${BASENAME%%+(-release*)}.apk"
APKDEST="$DEST/$APKNAME"
${TOOLS}/zipalign -c -v -p 4 $APK
cp $APK $APKDEST
${TOOLS}/apksigner sign --ks $STORE_PATH --ks-key-alias $STORE_ALIAS --ks-pass env:KEY_STORE_PASSWORD --key-pass env:KEY_PASSWORD $APKDEST
) &
# Allow to execute up to $MAX_PARALLEL jobs in parallel
if [[ $(jobs -r -p | wc -l) -ge $MAX_PARALLEL ]]; then
wait -n
fi
done
wait
rm $STORE_PATH
unset KEY_STORE_PASSWORD
unset KEY_PASSWORD

View file

@ -0,0 +1,25 @@
name: "Batch close stale issues"
on:
# Monthly
schedule:
- cron: '0 0 1 * *'
# Manual trigger
workflow_dispatch:
inputs:
jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # v9
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
# Close everything older than ~6 months
days-before-issue-stale: 180
days-before-issue-close: 0
exempt-issue-labels: "do-not-autoclose,Meta request"
close-issue-message: "In an effort to have a more manageable issue backlog, we're closing older requests that weren't addressed since there's a low chance of it being addressed if it hasn't already. If your request is still relevant, please [open a new request](https://github.com/aniyomiorg/aniyomi-extensions/issues/new/choose)."
close-issue-reason: not_planned
ascending: true
operations-per-run: 250

View file

@ -0,0 +1,76 @@
name: PR build check
on:
pull_request:
paths:
- '**'
- '!**.md'
- '!.github/**'
- '.github/workflows/build_pull_request.yml'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- 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 PR
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- name: Set up JDK
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4
with:
java-version: 17
distribution: temurin
- name: Set up Gradle
uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3
with:
cache-read-only: true
- name: Build extensions (chunk ${{ matrix.chunk }})
env:
CI_CHUNK_NUM: ${{ matrix.chunk }}
run: ./gradlew -p src assembleDebug

178
.github/workflows/build_push.yml vendored Normal file
View file

@ -0,0 +1,178 @@
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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
ref: master
token: ${{ secrets.ANIYOMIORG_BOT_PAT }}
- name: Find lib changes
id: modified-libs
uses: tj-actions/changed-files@90a06d6ba9543371ab4df8eeca0be07ca6054959 #v42
with:
files: lib/
files_ignore: lib/**.md
files_separator: " "
safe_output: false
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@01dd5d3ca463c7f10f7f4f7b4f177225ac661ee4 # v6.1.0
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true
# 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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
ref: master
- name: Set up JDK
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4
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@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3
- 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@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4
if: "github.repository == 'aniyomiorg/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 == 'aniyomiorg/aniyomi-extensions'"
runs-on: ubuntu-latest
steps:
- name: Download APK artifacts
uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4
with:
path: ~/apk-artifacts
- name: Set up JDK
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4
with:
java-version: 17
distribution: temurin
- name: Checkout master branch
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
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/aniyomiorg/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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
repository: aniyomiorg/aniyomi-extensions
token: ${{ secrets.ANIYOMIORG_BOT_PAT }}
ref: repo
path: repo
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@01dd5d3ca463c7f10f7f4f7b4f177225ac661ee4 # v6.1.0
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true
workdir: repo
- name: Deploy repo
run: |
cd repo
../master/.github/scripts/commit-repo.sh

51
.github/workflows/issue_moderator.yml vendored Normal file
View file

@ -0,0 +1,51 @@
name: Issue moderator
on:
issues:
types: [opened, edited, reopened]
issue_comment:
types: [created]
jobs:
autoclose:
runs-on: ubuntu-latest
steps:
- name: Moderate issues
uses: aniyomiorg/issue-moderator-action@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
duplicate-label: Duplicate
duplicate-check-enabled: true
duplicate-check-labels: |
["Source request", "Domain changed"]
existing-check-enabled: true
existing-check-labels: |
["Source request", "Domain changed"]
auto-close-rules: |
[
{
"type": "body",
"regex": ".*DELETE THIS SECTION IF YOU HAVE READ AND ACKNOWLEDGED IT.*",
"message": "The acknowledgment section was not removed."
},
{
"type": "body",
"regex": ".*\\* (Aniyomi version|Android version|Device): \\?.*",
"message": "Requested information in the template was not filled out."
},
{
"type": "title",
"regex": ".*(Source name|Short description).*",
"message": "You did not fill out the description in the title."
},
{
"type": "both",
"regex": ".*(?:fail(?:ed|ure|s)?|can\\s*(?:no|')?t|(?:not|un).*able|(?<!n[o']?t )blocked by|error) (?:to )?(?:get past|by ?pass|penetrate)?.*cloud ?fl?are.*",
"ignoreCase": true,
"message": "Refer to the **Solving Cloudflare issues** section at https://aniyomi.org/help/guides/troubleshooting/#solving-cloudflare-issues. If it doesn't work, migrate to other sources or wait until they lower their protection."
}
]
auto-close-ignore-label: do-not-autoclose

21
.github/workflows/lock.yml vendored Normal file
View file

@ -0,0 +1,21 @@
name: Lock threads
on:
# Daily
schedule:
- cron: '0 0 * * *'
# Manual trigger
workflow_dispatch:
inputs:
jobs:
lock:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- uses: dessant/lock-threads@1bf7ec25051fe7c00bdd17e6a7cf3d7bfb7dc771 # v5
with:
github-token: ${{ github.token }}
issue-inactive-days: '2'
pr-inactive-days: '2'