forked from usaweili/ClashForAndroid-Geoip-geoip.clash.dev
-
Notifications
You must be signed in to change notification settings - Fork 1
65 lines (58 loc) · 2.17 KB
/
android.yml
File metadata and controls
65 lines (58 loc) · 2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: Android CI
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"
push:
branches: [ "geolite.clash.dev" ]
pull_request:
branches: [ "geolite.clash.dev" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: gradle
- name: Set variables
run: |
echo "TAG_NAME=$(date +%s)" >> $GITHUB_ENV
shell: bash
- name: Update local.properties
run: |
sed -i "s/^project.version_code=.*/project.version_code=${TAG_NAME}/" local.properties
sed -i "s/^project.version_name=.*/project.version_name=${TAG_NAME}/" local.properties
cat local.properties
shell: bash
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Gradle clean
run: ./gradlew clean
- name: Build with Gradle
run: ./gradlew build
- name: Upload files to GitHub release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file_glob: true
file: ./app/build/outputs/apk/release/*
tag: ${{ env.TAG_NAME }}
- name: Git push json to "release_info" branch
run: |
apk_name=$(basename $(ls ./app/build/outputs/apk/release/*.apk))
apk_name=$(echo "$apk_name" | sed 's/(\([0-9]\+\))/.\1/g')
mkdir -p release_info
cd release_info || exit 1
echo "{\"newVersion\": ${TAG_NAME}, \"downloadUrl\": \"https://github.com/JohnnySun/ClashForAndroid-Geoip/releases/download/${TAG_NAME}/${apk_name}\"}" | jq '{newVersion, downloadUrl}' > version_info.json
git init
git config --local user.name "github-actions[bot]"
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git checkout -b release_info
git add -A
git commit -m "${{ env.TAG_NAME }}"
git remote add android_geoip_release_info "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}"
git push -f -u android_geoip_release_info release_info