forked from Chipppppppppp/LIME
-
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
2505339
commit 73db417
Showing
1 changed file
with
114 additions
and
74 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 |
---|---|---|
@@ -1,95 +1,135 @@ | ||
name: LIMEビルドとパッチ | ||
name: Build | ||
|
||
on: | ||
push: | ||
paths: | ||
- '.github/workflows/build.yml' | ||
- 'app/**' | ||
- 'gradle/**' | ||
- '*.gradle' | ||
- '*.properties' | ||
pull_request: | ||
workflow_dispatch: | ||
inputs: | ||
release: | ||
description: 'リリースビルドを作成しますか?' | ||
description: 'Release' | ||
type: boolean | ||
required: true | ||
default: 'false' | ||
default: false | ||
lspatch: | ||
description: 'LSPatchを適用しますか?' | ||
description: 'LSPatch' | ||
type: boolean | ||
required: true | ||
default: 'true' | ||
default: false | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: write | ||
steps: | ||
- name: リポジトリのチェックアウト | ||
uses: actions/checkout@v2 | ||
|
||
- name: Javaのセットアップ | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: '21' | ||
distribution: 'temurin' | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set environments | ||
run: | | ||
echo "version=v$(grep versionName app/build.gradle | awk '{print $2}' | tr -d \")" >> $GITHUB_ENV | ||
echo "line_ver_code=$(grep HOOK_TARGET_VERSION app/build.gradle | awk '{print $4}' | tr -d \'\")" >> $GITHUB_ENV | ||
echo "commit=$(echo ${{ github.sha }} | cut -c-7)" >> $GITHUB_ENV | ||
echo "repo=$(echo ${GITHUB_REPOSITORY#$GITHUB_REPOSITORY_OWNER/})" >> $GITHUB_ENV | ||
- name: Set LINE Original Version Name | ||
run: echo "line_ver=$(echo '${{ env.line_ver_code }}' | awk '{print substr($0,1,2)"."substr($0,3,2)"."int(substr($0,5,1))}')" >> $GITHUB_ENV | ||
|
||
- name: Setup Java | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'temurin' | ||
java-version: 21 | ||
|
||
- name: Setup Gradle | ||
uses: gradle/actions/setup-gradle@v4 | ||
|
||
- name: Gradleのセットアップ | ||
uses: gradle/actions/setup-gradle@v2 | ||
with: | ||
gradle-version: '7.6.1' | ||
- name: Get previous version name | ||
uses: oprypin/[email protected] | ||
if: github.event.inputs.release == 'true' | ||
id: previous | ||
with: | ||
repository: ${{ github.repository }} | ||
releases-only: true | ||
|
||
- name: Gradleでビルド | ||
run: | | ||
if [ "${{ inputs.release }}" == "true" ]; then | ||
echo "${{ secrets.STORE_FILE }}" | base64 -d > app/release.jks | ||
export STORE_PASSWORD="${{ secrets.STORE_PASSWORD }}" | ||
export KEY_ALIAS="${{ secrets.KEY_ALIAS }}" | ||
export KEY_PASSWORD="${{ secrets.KEY_PASSWORD }}" | ||
./gradlew assembleRelease --no-daemon --stacktrace | ||
cp -f app/build/outputs/apk/release/app-release.apk ${{ env.repo }}-${{ env.version }}.apk | ||
else | ||
./gradlew assembleDebug --no-daemon --stacktrace | ||
fi | ||
- name: Release check | ||
if: github.event.inputs.release == 'true' | ||
run: | | ||
if [ -z "${{ secrets.STORE_FILE }}" ]; then | ||
echo -e "\nERROR!\nTo release, you need to set up a signing key!\n" | ||
echo "STORE_FILE: A Base64 encoded string of the signing key in JKS format" | ||
echo "STORE_PASSWORD: Key store password" | ||
echo "KEY_ALIAS: Key alias" | ||
echo "KEY_PASSWORD: Key password" | ||
exit 1 | ||
fi | ||
if [ "${{ steps.previous.outputs.tag }}" == "${{ env.version }}" ]; then | ||
echo -e "\nERROR!\nThe same tag already exists!\n" | ||
echo "Please change versionName in build.gradle" | ||
exit 1 | ||
fi | ||
- name: APK出力のリスト表示 | ||
run: | | ||
echo "APK出力のリスト表示:" | ||
ls -la app/build/outputs/apk/debug/ | ||
- name: Build with Gradle | ||
run: | | ||
if [ "${{ inputs.release }}" == "true" ]; then | ||
echo "${{ secrets.STORE_FILE }}" | base64 -d > app/release.jks | ||
export STORE_PASSWORD="${{ secrets.STORE_PASSWORD }}" | ||
export KEY_ALIAS="${{ secrets.KEY_ALIAS }}" | ||
export KEY_PASSWORD="${{ secrets.KEY_PASSWORD }}" | ||
./gradlew assembleRelease --no-daemon --stacktrace | ||
cp -f app/build/outputs/apk/release/app-release.apk ${{ env.repo }}-${{ env.version }}.apk | ||
else | ||
./gradlew assembleDebug --no-daemon --stacktrace | ||
fi | ||
- name: LSPatch | ||
if: github.event.inputs.lspatch == 'true' | ||
run: | | ||
cat << EOF > conf | ||
https://github.com/JingMatrix/LSPatch/releases/latest/download/lspatch.jar | ||
out=lspatch.jar | ||
https://dw.uptodown.net/dwn/EPg68xzS-22jffuYiEmWRTQoDPmpdIQpQjN7cd7jPOby7Pm84VwTQufPPdGJPTQ6x6WalMPFSXGvECpOG2BwqRhn6PSKnad9EZ3dKgvBC5lqcC33qVzXJJOeEGqT3Rs4/KuUd2YWGcEh4w6TG6IPUPWpcdjUYtJXZuGpV82jZWrp-N4TH7iVJ6V01iU5lbY_cUvwJucl22BSGqs5gPKg5mLGRnivYa3MTynb4taJkpfUB7_tUxlhuaVCuV2n_1_Lv/cSkXM9sGvQmHzAM9SWD4Mz_V0X6KChgaIPOaZYqhCPoAQ7AmBBh6o8h2krytqHO4/line-14-16-0.apk | ||
EOF | ||
echo "APKをダウンロード中..." | ||
aria2c --no-conf -x16 -s16 -R -m0 -V --async-dns=false -i conf || { echo "ダウンロード失敗"; exit 1; } | ||
echo "LIMEにパッチを当てています..." | ||
java -jar lspatch.jar "line-14-16-0.apk" -m "app/build/outputs/apk/debug/app-debug.apk" -l 2 -v || { echo "パッチ失敗"; exit 1; } | ||
- name: LSPatch | ||
if: github.event.inputs.lspatch == 'true' | ||
run: | | ||
cat << EOF > conf | ||
https://github.com/JingMatrix/LSPatch/releases/latest/download/lspatch.jar | ||
out=lspatch.jar | ||
https://dw.uptodown.net/dwn/EPg68xzS-22jffuYiEmWRTQoDPmpdIQpQjN7cd7jPOby7Pm84VwTQufPPdGJPTQ6x6WalMPFSXGvECpOG2BwqRhn6PSKnad9EZ3dKgvBC5lqcC33qVzXJJOeEGqT3Rs4/KuUd2YWGcEh4w6TG6IPUPWpcdjUYtJXZuGpV82jZWrp-N4TH7iVJ6V01iU5lbY_cUvwJucl22BSGqs5gPKg5mLGRnivYa3MTynb4taJkpfUB7_tUxlhuaVCuV2n_1_Lv/cSkXM9sGvQmHzAM9SWD4Mz_V0X6KChgaIPOaZYqhCPoAQ7AmBBh6o8h2krytqHO4/line-14-16-0.apk | ||
EOF | ||
echo "Downloading APK..." | ||
aria2c --no-conf -x16 -s16 -R -m0 -V --async-dns=false -i conf || { echo "Download failed"; exit 1; } | ||
echo "Patching LIME..." | ||
java -jar lspatch.jar "line-14-16-0.apk" -m "app/build/outputs/apk/debug/app-debug.apk" -l 2 -v || { echo "Patching failed"; exit 1; } | ||
- name: 生成されたAPKファイルのリスト表示 | ||
run: | | ||
echo "生成されたAPKファイル:" | ||
ls -la line-*-lspatched.apk || { echo "生成されたAPKファイルのリスト表示失敗"; exit 1; } | ||
# 生成されたAPKファイルをリスト表示 | ||
echo "生成されたAPKファイル:" | ||
ls -la line-*-lspatched.apk || { echo "Failed to list generated APK files"; exit 1; } | ||
- name: Upload Patched LINE APK | ||
if: github.event.inputs.lspatch == 'true' | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: LINE-${{ env.line_ver }}@${{ env.commit }} | ||
path: line-${{ env.line_ver }}-*-lspatched.apk | ||
if-no-files-found: error | ||
- name: Upload Patched LINE APK | ||
uses: actions/upload-artifact@v4 | ||
if: github.event.inputs.lspatch == 'true' | ||
with: | ||
name: LINE-${{ env.line_ver }}@${{ env.commit }} | ||
path: line-${{ env.line_ver }}-*-lspatched.apk | ||
if-no-files-found: error | ||
|
||
- name: Release | ||
if: github.event.inputs.release == 'true' | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
tag_name: ${{ env.version }} | ||
draft: false | ||
prerelease: false | ||
files: | | ||
${{ env.repo }}-${{ env.version }}.apk | ||
line-${{ env.line_ver }}-*-lspatched.apk | ||
body: | | ||
# 更新内容 | ||
## 対応するLINEのバージョン | ||
${{ env.line_ver }} | ||
### 差分 | ||
https://github.com/${{ github.repository }}/compare/${{ steps.previous.outputs.tag }}...${{ env.version }} | ||
- name: Release | ||
uses: softprops/action-gh-release@v2 | ||
if: github.event.inputs.release == 'true' | ||
with: | ||
tag_name: ${{ env.version }} | ||
draft: false | ||
prerelease: false | ||
files: | | ||
${{ env.repo }}-${{ env.version }}.apk | ||
line-${{ env.line_ver }}-*-lspatched.apk | ||
body: | | ||
# 更新内容 | ||
## 対応するLINEのバージョン | ||
${{ env.line_ver }} | ||
### 差分 | ||
https://github.com/${{ github.repository }}/compare/${{ steps.previous.outputs.tag }}...${{ env.version }} |