-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
81f1919
commit c9f2ef7
Showing
5 changed files
with
96 additions
and
10 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,12 +8,69 @@ jobs: | |
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'zulu' | ||
java-version: '17' | ||
- uses: robinraju/[email protected] | ||
with: | ||
repository: "iBotPeaches/Apktool" | ||
latest: true | ||
fileName: "*.jar" | ||
- name: sign | ||
run: | | ||
tag_version=`git describe --tags --abbrev=0` | ||
echo "current tag: ${tag_version}" | ||
echo "tag_version=${tag_version}" >> $GITHUB_OUTPUT | ||
sudo apt update | ||
sudo apt -y install apksigner | ||
sudo apt -y install apksigner zipalign jq | ||
updateURL=`curl "${{ secrets.API_URL }}" | jq -r .updateURL` | ||
version=`curl "${{ secrets.API_URL }}" | jq -r .version` | ||
versionTitle=`curl "${{ secrets.API_URL }}" | jq -r .versionTitle` | ||
echo "version=${version}" >> $GITHUB_OUTPUT | ||
echo "version=${version}" >> $GITHUB_OUTPUT | ||
echo "tag_version=${tag_version}" >> $GITHUB_OUTPUT | ||
curl -L "$updateURL" -o adguard.apk | ||
echo "${{ secrets.SIGN_KEY }}" | base64 -d > sign.keystore | ||
mv apktool_*.jar apktool.jar | ||
java -jar apktool.jar d adguard.apk --use-aapt2 | ||
python main.py "${version}" "${versionTitle}" | ||
curl -L "https://github.com/creeper-0910/adg_translate_ja/raw/main/plurals.xml" -o ./adguard/res/values-ja/plurals.xml | ||
curl -L "https://github.com/creeper-0910/adg_translate_ja/raw/main/strings.xml" -o ./adguard/res/values-ja/strings.xml | ||
java -jar apktool.jar b adguard -o adguard_rebuild.apk --use-aapt2 | ||
zipalign -f -v 4 adguard_rebuild.apk adguard_aligned.apk | ||
apksigner sign --ks sign.keystore --ks-pass ${{ secrets.KEY }} -v adguard_aligned.apk | ||
cat src/index.ts | ||
id: version | ||
- uses: rickstaa/action-create-tag@v1 | ||
if: steps.version.outputs.tag_version != steps.version.outputs.version | ||
id: tag_create | ||
with: | ||
tag: ${{ steps.version.outputs.version }} | ||
tag_exists_error: false | ||
message: "release ${{ steps.version.outputs.versionTitle }}" | ||
- uses: actions/[email protected] | ||
id: create_release | ||
if: steps.version.outputs.tag_version != steps.version.outputs.version | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ steps.version.outputs.version }} | ||
release_name: Release ${{ steps.version.outputs.versionTitle }} | ||
draft: false | ||
prerelease: false | ||
- uses: actions/upload-release-asset@v1 | ||
if: steps.version.outputs.tag_version != steps.version.outputs.version | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./adguard_aligned.apk | ||
asset_name: adguard.apk | ||
asset_content_type: application/vnd.android.package-archive | ||
- name: Cleanup | ||
run: | | ||
rm -rf adguard sign.keystore apktool.jar adguard_rebuild.apk adguard_aligned.apk adguard.apk | ||
ls |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,6 @@ | ||
node_modules | ||
node_modules | ||
*.apk | ||
*.keystore | ||
*.jar | ||
adguard | ||
*.xml |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# -*- coding: utf-8 -*- | ||
import re | ||
import sys | ||
import glob | ||
args = sys.argv | ||
beforeWord = 'https://mobile-api.adguard.org/api/2.0/checkupdate.html' | ||
afterWord = 'https://upd-adgrd.cf-inagi-saki.workers.dev/' | ||
files = glob.glob("./adguard/**/*.smali", recursive=True) | ||
for file in files : | ||
with open(file, "r") as f : | ||
result = [ row.replace(beforeWord, afterWord) for row in f ] | ||
with open(file, "w") as f : | ||
f.writelines(result) | ||
with open("src/index.ts", 'r') as f: | ||
content = f.read() | ||
result = re.sub(r'const latest_version = "(.*)"', "const latest_version = \""+args[1]+"\"", content) | ||
result = re.sub(r'const latest_display_version = "(.*)"', "const latest_display_version = \""+args[2]+"\"", content) | ||
with open("src/index.ts", 'w') as f: | ||
f.write(result) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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