mirror of
https://github.com/dyhkwong/Exclave.git
synced 2026-06-20 23:16:06 +08:00
Add xtls-plugin release build to action
This commit is contained in:
163
.github/workflows/release_xtls.yml
vendored
Normal file
163
.github/workflows/release_xtls.yml
vendored
Normal file
@@ -0,0 +1,163 @@
|
||||
name: XTLS Plugin Release Build
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: 'Release Tag'
|
||||
required: true
|
||||
upload:
|
||||
description: 'Upload: If want ignore'
|
||||
required: false
|
||||
# publish:
|
||||
# description: 'Publish: If want ignore'
|
||||
# required: false
|
||||
jobs:
|
||||
check:
|
||||
name: Check Access
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: "Check access"
|
||||
uses: "lannonbr/repo-permission-check-action@2.0.0"
|
||||
with:
|
||||
permission: "write"
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
native:
|
||||
name: Native Build
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- check
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Fetch Status
|
||||
run: git submodule status 'xtls-plugin/*' > xtls_status
|
||||
- name: XTLS Cache
|
||||
id: cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
xtls-plugin/src/main/jniLibs
|
||||
key: ${{ hashFiles('bin/libs/xtls.sh', 'xtls_status') }}
|
||||
- name: Gradle cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.gradle
|
||||
key: gradle-${{ hashFiles('**/*.gradle') }}
|
||||
- name: Install Golang
|
||||
uses: actions/setup-go@v2
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
with:
|
||||
go-version: 1.16
|
||||
- name: Native Build
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
./run libs xtls
|
||||
build:
|
||||
name: Gradle Build
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- native
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Fetch Status
|
||||
run: git submodule status 'xtls-plugin/*' > xtls_status
|
||||
- name: XTLS Cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
xtls-plugin/src/main/jniLibs
|
||||
key: ${{ hashFiles('bin/libs/xtls.sh', 'xtls_status') }}
|
||||
- name: Gradle cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.gradle
|
||||
key: gradle-${{ hashFiles('**/*.gradle') }}
|
||||
- name: Release Build
|
||||
run: |
|
||||
echo "sdk.dir=${ANDROID_HOME}" > local.properties
|
||||
echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties
|
||||
export LOCAL_PROPERTIES="${{ secrets.LOCAL_PROPERTIES }}"
|
||||
./gradlew xtls-plugin:assembleRelease
|
||||
APK=$(find xtls-plugin/build/outputs/apk -name '*arm64-v8a*.apk')
|
||||
APK=$(dirname $APK)
|
||||
echo "APK=$APK" >> $GITHUB_ENV
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: XTLS
|
||||
path: ${{ env.APK }}
|
||||
publish:
|
||||
name: Publish Release
|
||||
if: github.event.inputs.publish != 'y'
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Donwload Artifacts
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
path: artifacts
|
||||
- name: Release
|
||||
run: |
|
||||
wget -O ghr.tar.gz https://github.com/tcnksm/ghr/releases/download/v0.13.0/ghr_v0.13.0_linux_amd64.tar.gz
|
||||
tar -xvf ghr.tar.gz
|
||||
mv ghr*linux_amd64/ghr .
|
||||
mkdir apks
|
||||
find artifacts -name "*.apk" -exec cp {} apks \;
|
||||
./ghr -delete -t "${{ github.token }}" -n "${{ github.event.inputs.tag }}" "${{ github.event.inputs.tag }}" apks
|
||||
upload:
|
||||
name: Upload Release
|
||||
if: github.event.inputs.upload != 'y'
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
steps:
|
||||
- name: Donwload Artifacts
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
path: artifacts
|
||||
- name: Release
|
||||
run: |
|
||||
mkdir apks
|
||||
find artifacts -name "*.apk" -exec cp {} apks \;
|
||||
function upload() {
|
||||
for apk in $@; do
|
||||
echo ">> Uploading $apk"
|
||||
curl https://api.telegram.org/bot${{ secrets.TELEGRAM_TOKEN }}/sendDocument \
|
||||
-X POST \
|
||||
-F chat_id="${{ secrets.TELEGRAM_CHANNEL }}" \
|
||||
-F document="@$apk" \
|
||||
--silent --show-error --fail >/dev/null &
|
||||
done
|
||||
for job in $(jobs -p); do
|
||||
wait $job || exit 1
|
||||
done
|
||||
}
|
||||
upload apks/*.apk
|
||||
# play:
|
||||
# name: Publish to Play Store
|
||||
# if: github.event.inputs.upload != 'y'
|
||||
# runs-on: ubuntu-latest
|
||||
# needs:
|
||||
# - native
|
||||
# steps:
|
||||
# - name: Checkout
|
||||
# uses: actions/checkout@v2
|
||||
# - name: Fetch Status
|
||||
# run: git submodule status 'xtls-plugin/*' > xtls_status
|
||||
# - name: XTLS Cache
|
||||
# uses: actions/cache@v2
|
||||
# with:
|
||||
# path: |
|
||||
# xtls-plugin/src/main/jniLibs
|
||||
# key: ${{ hashFiles('bin/libs/xtls.sh', 'xtls_status') }}
|
||||
# - name: Release Build
|
||||
# run: |
|
||||
# echo "sdk.dir=${ANDROID_HOME}" > local.properties
|
||||
# echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties
|
||||
# export LOCAL_PROPERTIES="${{ secrets.LOCAL_PROPERTIES }}"
|
||||
# cat > service_account_credentials.json << EOF
|
||||
# ${{ secrets.ANDROID_PUBLISHER_CREDENTIALS }}"
|
||||
# EOF
|
||||
# ./gradlew xtls-plugin:publishRelease
|
||||
@@ -134,7 +134,7 @@ class AboutFragment : ToolbarFragment(R.layout.layout_about) {
|
||||
addItem(MaterialAboutActionItem.Builder()
|
||||
.icon(R.drawable.ic_baseline_nfc_24)
|
||||
.text(getString(R.string.version_x, plugin.id))
|
||||
.subText(plugin.versionName)
|
||||
.subText("v" + plugin.versionName)
|
||||
.setOnClickAction {
|
||||
startActivity(Intent().apply {
|
||||
action = Settings.ACTION_APPLICATION_DETAILS_SETTINGS
|
||||
|
||||
@@ -38,7 +38,7 @@ android {
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 30
|
||||
versionCode 1
|
||||
versionName "v1.4.2"
|
||||
versionName "1.4.2"
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
@@ -68,7 +68,7 @@ android {
|
||||
|
||||
applicationVariants.all { variant ->
|
||||
variant.outputs.all { output ->
|
||||
outputFileName = outputFileName.replace("app", "xtls-plugin-" + variant.versionName)
|
||||
outputFileName = outputFileName.replace("xtls-plugin", "xtls-plugin-" + variant.versionName)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<application
|
||||
android:allowBackup="false"
|
||||
android:extractNativeLibs="true"
|
||||
android:label="Xray Plugin">
|
||||
android:label="XTLS Plugin">
|
||||
<provider
|
||||
android:name=".BinaryProvider"
|
||||
android:authorities="io.nekohasekai.sagernet.plugin.xtls.BinaryProvider"
|
||||
|
||||
Reference in New Issue
Block a user