| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247 |
- name: NaïveProxy 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
- play:
- description: 'Play: If want ignore'
- required: false
- jobs:
- check:
- name: Check Access
- runs-on: ubuntu-latest
- steps:
- - name: "Check access"
- uses: "lannonbr/[email protected]"
- with:
- permission: "write"
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- native:
- runs-on: ubuntu-latest
- name: Native Build (NaïveProxy)
- strategy:
- fail-fast: false
- matrix:
- arch: [ armeabi-v7a, arm64-v8a, x86, x86_64 ]
- steps:
- - name: Checkout
- uses: actions/checkout@v2
- - name: Fetch Status
- run: git submodule status 'plugin/naive/*' > naive_status
- - name: Naive Cache
- id: cache
- uses: actions/cache@v2
- with:
- path: |
- plugin/naive/src/main/jniLibs/${{ matrix.arch }}
- key: naive-${{ matrix.arch }}-${{ hashFiles('bin/plugin/naive/*', 'naive_status') }}
- - name: Gradle cache
- uses: actions/cache@v2
- if: steps.cache.outputs.cache-hit != 'true'
- with:
- path: ~/.gradle
- key: native-${{ hashFiles('**/*.gradle.kts') }}
- - name: Native Build
- if: steps.cache.outputs.cache-hit != 'true'
- run: |
- echo "sdk.dir=${ANDROID_HOME}" > local.properties
- echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties
- ./run init action naive
- ./run plugin naive init
- ./run plugin naive ${{ matrix.arch }}
- - name: Calculate SHA256
- run: |
- openssl sha256 plugin/naive/src/main/jniLibs/${{ matrix.arch }}/libnaive.so > sha256sum.txt
- echo "SHA256SUM=$(cut -d' ' -f2 sha256sum.txt)" >>$GITHUB_ENV
- - uses: actions/upload-artifact@v2
- with:
- name: "NAIVE-SHA256-${{ matrix.arch }} ${{ env.SHA256SUM }}"
- path: sha256sum.txt
- build:
- name: Gradle Build (NaïveProxy)
- runs-on: ubuntu-latest
- needs:
- - native
- - check
- steps:
- - name: Checkout
- uses: actions/checkout@v2
- - name: Fetch Status
- run: git submodule status 'plugin/naive/*' > naive_status
- - name: Naive Cache (armeabi-v7a)
- uses: actions/cache@v2
- with:
- path: |
- plugin/naive/src/main/jniLibs/armeabi-v7a
- key: naive-armeabi-v7a-${{ hashFiles('bin/plugin/naive/*', 'naive_status') }}
- - name: Naive Cache (arm64-v8a)
- uses: actions/cache@v2
- with:
- path: |
- plugin/naive/src/main/jniLibs/arm64-v8a
- key: naive-arm64-v8a-${{ hashFiles('bin/plugin/naive/*', 'naive_status') }}
- - name: Naive Cache (x86)
- uses: actions/cache@v2
- with:
- path: |
- plugin/naive/src/main/jniLibs/x86
- key: naive-x86-${{ hashFiles('bin/plugin/naive/*', 'naive_status') }}
- - name: Naive Cache (x86_64)
- uses: actions/cache@v2
- with:
- path: |
- plugin/naive/src/main/jniLibs/x86_64
- key: naive-x86_64-${{ hashFiles('bin/plugin/naive/*', 'naive_status') }}
- - name: Gradle cache
- uses: actions/cache@v2
- with:
- path: ~/.gradle
- key: native-${{ hashFiles('**/*.gradle.kts') }}
- - name: Native Build
- env:
- SKIP_BUILD: on
- BUILD_PLUGIN: naive
- 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 }}"
- ./run init action library
- ./gradlew :plugin:naive:assembleOssRelease
- APK=$(find plugin/naive/build/outputs/apk -name '*arm64-v8a*.apk')
- APK=$(dirname $APK)
- echo "APK=$APK" >> $GITHUB_ENV
- - uses: actions/upload-artifact@v2
- with:
- name: APKs
- path: ${{ env.APK }}
- - uses: actions/upload-artifact@v2
- with:
- name: "SHA256-ARM ${{ env.SHA256_ARM }}"
- path: ${{ env.SUM_ARM }}
- - uses: actions/upload-artifact@v2
- with:
- name: "SHA256-ARM64 ${{ env.SHA256_ARM64 }}"
- path: ${{ env.SUM_ARM64 }}
- - uses: actions/upload-artifact@v2
- with:
- name: "SHA256-X64 ${{ env.SHA256_X64 }}"
- path: ${{ env.SUM_X64 }}
- - uses: actions/upload-artifact@v2
- with:
- name: "SHA256-X86 ${{ env.SHA256_X86 }}"
- path: ${{ env.SUM_X86 }}
- 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:
- name: APKs
- 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 \;
- find artifacts -name "*.sha256sum.txt" -exec cp {} apks \;
- ./ghr -delete -prerelease -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:
- name: APKs
- 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/*
- play:
- name: Publish to Play Store
- if: github.event.inputs.play != 'y'
- runs-on: ubuntu-latest
- needs:
- - native
- - check
- steps:
- - name: Checkout
- uses: actions/checkout@v2
- - name: Fetch Status
- run: git submodule status 'plugin/naive/*' > naive_status
- - name: Naive Cache (armeabi-v7a)
- uses: actions/cache@v2
- with:
- path: |
- plugin/naive/src/main/jniLibs/armeabi-v7a
- key: naive-armeabi-v7a-${{ hashFiles('bin/plugin/naive/*', 'naive_status') }}
- - name: Naive Cache (arm64-v8a)
- uses: actions/cache@v2
- with:
- path: |
- plugin/naive/src/main/jniLibs/arm64-v8a
- key: naive-arm64-v8a-${{ hashFiles('bin/plugin/naive/*', 'naive_status') }}
- - name: Naive Cache (x86)
- uses: actions/cache@v2
- with:
- path: |
- plugin/naive/src/main/jniLibs/x86
- key: naive-x86-${{ hashFiles('bin/plugin/naive/*', 'naive_status') }}
- - name: Naive Cache (x86_64)
- uses: actions/cache@v2
- with:
- path: |
- plugin/naive/src/main/jniLibs/x86_64
- key: naive-x86_64-${{ hashFiles('bin/plugin/naive/*', 'naive_status') }}
- - name: Gradle cache
- uses: actions/cache@v2
- with:
- path: ~/.gradle
- key: native-${{ hashFiles('**/*.gradle.kts') }}
- - name: Native Build
- env:
- SKIP_BUILD: on
- BUILD_PLUGIN: naive
- 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
- ./run init action library
- ./gradlew :plugin:naive:publishPlayReleaseBundle
|