Skip to content

Build

Build #681

Workflow file for this run

name: Build
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
jobs:
build:
runs-on: ubuntu-22.04
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"
tag: "v2.9.3"
fileName: "*.jar"
- uses: actions/setup-node@v3
with:
node-version: 16
- 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 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 "versionTitle=${versionTitle}" >> $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
echo "${version}:${versionTitle}"
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 -p -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: Push
if: steps.version.outputs.tag_version != steps.version.outputs.version
run: |
rm -rf adguard sign.keystore apktool.jar adguard_rebuild.apk adguard_aligned.apk adguard.apk adguard_aligned.apk.idsig
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add .
git commit --allow-empty -m "Update Update-Server"
git push origin
- name: Cleanup
if: steps.version.outputs.tag_version != steps.version.outputs.version
run: |
rm -rf main.py
npm i
- uses: cloudflare/[email protected]
if: steps.version.outputs.tag_version != steps.version.outputs.version
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
command: publish --minify src/index.ts