Skip to content

Hysteria 2 Plugin Build #13

Hysteria 2 Plugin Build

Hysteria 2 Plugin Build #13

name: Hysteria 2 Plugin Build
on:
workflow_dispatch:
inputs:
tag:
description: 'Release Tag'
required: true
publish:
description: 'Publish: If want ignore'
required: false
jobs:
native:
name: Native Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Fetch Status
run: git submodule status 'plugin/hysteria2/*' > hysteria2_status
- name: Hysteria 2 Cache
id: cache
uses: actions/cache@v4
with:
path: |
plugin/hysteria2/src/main/jniLibs
key: ${{ hashFiles('.github/workflows/*', 'bin/lib/hysteria2/*', 'hysteria2_status') }}
- name: Gradle cache
uses: actions/cache@v4
with:
path: ~/.gradle
key: gradle-${{ hashFiles('**/*.gradle.kts') }}
- name: Golang Version
if: steps.cache.outputs.cache-hit != 'true'
id: version
run: |
source buildScript/init/version.sh
echo go_version=$GO_VERSION >> $GITHUB_OUTPUT
- name: Install Golang
uses: actions/setup-go@v5
if: steps.cache.outputs.cache-hit != 'true'
with:
go-version: ${{ steps.version.outputs.go_version }}
- name: Native Build
if: steps.cache.outputs.cache-hit != 'true'
run: ./run plugin hysteria2
build:
name: Gradle Build
runs-on: ubuntu-latest
needs:
- native
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Fetch Status
run: git submodule status 'plugin/hysteria2/*' > hysteria2_status
- name: Hysteria 2 Cache
uses: actions/cache@v4
with:
path: |
plugin/hysteria2/src/main/jniLibs
key: ${{ hashFiles('.github/workflows/*', 'bin/lib/hysteria2/*', 'hysteria2_status') }}
- name: Gradle cache
uses: actions/cache@v4
with:
path: ~/.gradle
key: gradle-${{ hashFiles('**/*.gradle.kts') }}
- uses: actions/setup-java@v4
with:
java-version: "17"
distribution: "temurin"
- name: Release Build
env:
SKIP_BUILD: on
BUILD_PLUGIN: hysteria2
run: |
echo "sdk.dir=${ANDROID_HOME}" > local.properties
# export LOCAL_PROPERTIES="${{ secrets.LOCAL_PROPERTIES }}"
KEYSTORE_PASS="${{ secrets.KEYSTORE_PASS }}" ALIAS_NAME="${{ secrets.ALIAS_NAME }}" ALIAS_PASS="${{ secrets.ALIAS_PASS}}" ./gradlew :plugin:hysteria2:assembleFossRelease
APK=$(find plugin/hysteria2/build/outputs/apk -name '*arm64-v8a*.apk')
APK=$(dirname "$APK")
echo "APK=$APK" >> $GITHUB_ENV
- uses: actions/upload-artifact@v4
with:
name: APKs
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@v4
with:
submodules: recursive
- name: Donwload Artifacts
uses: actions/download-artifact@v4
with:
name: APKs
path: artifacts
- name: Release
run: |
wget -O ghr.tar.gz https://github.com/tcnksm/ghr/releases/download/v0.16.2/ghr_v0.16.2_linux_amd64.tar.gz
tar -xvf ghr.tar.gz
mv ghr*linux_amd64/ghr .
mkdir apks
find artifacts -name "*.apk" -exec cp {} apks \;
find artifacts -name "*.sha256sum.txt" -exec cp {} apks \;
./ghr -delete -prerelease -t "${{ github.token }}" -n "${{ github.event.inputs.tag }}" "${{ github.event.inputs.tag }}" apks