1
0
mirror of https://github.com/areteruhiro/LIME-beta-hiro.git synced 2025-02-11 07:51:37 +09:00
LIME-beta-hiro/.github/workflows/build.yml
2025-02-04 12:56:28 +09:00

142 lines
5.3 KiB
YAML

name: Build
on:
push:
pull_request:
workflow_dispatch:
inputs:
release:
description: 'Release'
type: boolean
required: true
default: false
lspatch:
description: 'LSPatch'
type: boolean
required: true
default: false
jobs:
build:
name: Build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set environments
run: |
{
echo "version=v$(grep versionName app/build.gradle | awk '{print $2}' | tr -d \")"
echo "line_ver_code=$(grep HOOK_TARGET_VERSION app/build.gradle | awk '{print $4}' | tr -d \'\")"
echo "commit=$(echo ${{ github.sha }} | cut -c-7)"
echo "repo=$(echo ${GITHUB_REPOSITORY#$GITHUB_REPOSITORY_OWNER/})"
echo "versionName=$(grep versionName app/build.gradle | awk '{print $2}' | tr -d \")"
} >> $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: Release check
if: github.event.inputs.release == 'true'
run: |
if [ "${{ 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"
echo ""
exit 1
fi
if [ "${{ steps.previous.outputs.tag }}" == "${{ env.versionName }}" ]; then
echo -e "\nERROR!\nThe same tag already exists!\n"
echo "Please change versionName in build.gradle"
echo ""
exit 1
fi
- name: Download Required APKs
if: github.event.inputs.release == 'true'
run: |
curl -L -o LINE.15.0.0.arm64-v8a.armeabi-v7a.apk https://github.com/areteruhiro/LIMEs/releases/download/v1.16.10beta/LINE.15.0.0.arm64-v8a.armeabi-v7a.apk
curl -L -o LINE.15.0.0.armeabi-v7a.apk https://github.com/areteruhiro/LIMEs/releases/download/v1.16.10beta/armeabi-v7a-15-0-0.apk
curl -L -o LINE.15.0.0arm64-v8a.apk https://github.com/areteruhiro/LIMEs/releases/download/v1.16.10beta/LINE.15.0.0arm64-v8a.apk
- name: Download LSPatch
if: github.event.inputs.release == 'true'
run: |
curl -L -o lspatch.jar https://github.com/JingMatrix/LSPatch/releases/download/v0.7/lspatch.jar
- name: Build with Gradle
run: |
if [ "${{ github.event.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.release == 'true'
run: |
for file in LINE.15.0.0.arm64-v8a.armeabi-v7a.apk LINE.15.0.0.armeabi-v7a.apk LINE.15.0.0arm64-v8a.apk; do
echo "Patching $file..."
java -jar lspatch.jar "$file" -m "${{ env.repo }}-${{ env.version }}.apk" -l 2 -v
# Determine the expected output file name
output_file="${file%.apk}-430-lspatched.apk"
# List the current directory to see what files are present
echo "Current directory contents after patching:"
ls -l
# Move the patched file using the correct naming convention
mv "$output_file" "Patched_${{ env.version }}_$file" || echo "Patched file not found for $file"
done
- name: Upload module (Debug)
uses: actions/upload-artifact@v4
if: github.event.inputs.release != 'true'
with:
name: ${{ env.repo }}-${{ env.versionName }}@${{ env.commit }}
path: app/build/outputs/apk/debug/app-debug.apk
if-no-files-found: error
- 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
Patched_${{ env.version }}_LINE.15.0.0.arm64-v8a.armeabi-v7a.apk
Patched_${{ env.version }}_LINE.15.0.0.armeabi-v7a.apk
Patched_${{ env.version }}_LINE.15.0.0arm64-v8a.apk
body: |
# 更新内容
## 対応するLINEのバージョン
14.19.1 <br>14.21.1 <br>15.0.0 <br>15.1.0
### 差分
https://github.com/${{ github.repository }}/compare/${{ env.version }}^...${{ env.version }}