v0.34.1 #200
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| workflow_dispatch: | |
| release: | |
| types: [ published ] | |
| branches: [ master ] | |
| jobs: | |
| build_assets: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout codebase | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| check-latest: true | |
| id: go | |
| - name: Get dependencies | |
| run: | | |
| go get -v -t -d ./... | |
| if [ -f Gopkg.toml ]; then | |
| curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh | |
| dep ensure | |
| fi | |
| - name: Build | |
| run: | | |
| chmod +x build.assets.sh | |
| ./build.assets.sh | |
| - name: Get NPS version | |
| id: version | |
| run: | | |
| if [ -f "lib/version/version.go" ]; then | |
| version=$(grep -oP '(?<=const VERSION = ")[^"]*' lib/version/version.go) | |
| echo "NPS version: $version" | |
| echo "NPS_VERSION=$version" >> $GITHUB_ENV | |
| fi | |
| - name: Upload | |
| uses: softprops/action-gh-release@v2 | |
| if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' | |
| with: | |
| tag_name: v${{ env.NPS_VERSION }} | |
| files: "*.tar.gz" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Trigger Update NPS OpenWRT | |
| run: | | |
| curl -X POST https://api.github.com/repos/djylb/nps-openwrt/dispatches \ | |
| -H "Accept: application/vnd.github+json" \ | |
| -H "Authorization: Bearer ${{ secrets.GH_PAT }}" \ | |
| -d '{"event_type":"trigger-update"}' | |
| - name: Trigger Sync to nps-mirror | |
| if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' | |
| run: | | |
| curl -X POST https://api.github.com/repos/djylb/nps-mirror/dispatches \ | |
| -H "Accept: application/vnd.github+json" \ | |
| -H "Authorization: Bearer ${{ secrets.GH_PAT }}" \ | |
| -d '{ | |
| "event_type": "sync_nps_release", | |
| "client_payload": { | |
| "tag": "v${{ env.NPS_VERSION }}" | |
| } | |
| }' | |
| build_assets_old: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout codebase | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| check-latest: true | |
| id: go | |
| - name: Setup the patched Go version for Windows 7 | |
| run: | | |
| GOSDK=$(go env GOROOT) | |
| rm -r $GOSDK/* | |
| cd $GOSDK | |
| curl -O -L https://github.com/XTLS/go-win7/releases/latest/download/go-for-win7-linux-amd64.zip | |
| unzip ./go-for-win7-linux-amd64.zip -d $GOSDK | |
| rm ./go-for-win7-linux-amd64.zip | |
| - name: Get dependencies | |
| run: | | |
| go get -v -t -d ./... | |
| if [ -f Gopkg.toml ]; then | |
| curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh | |
| dep ensure | |
| fi | |
| - name: Build (old) | |
| run: | | |
| chmod +x build.assets.old.sh | |
| ./build.assets.old.sh | |
| - name: Get NPS version | |
| id: version | |
| run: | | |
| if [ -f "lib/version/version.go" ]; then | |
| version=$(grep -oP '(?<=const VERSION = ")[^"]*' lib/version/version.go) | |
| echo "NPS version: $version" | |
| echo "NPS_VERSION=$version" >> $GITHUB_ENV | |
| fi | |
| - name: Upload | |
| uses: softprops/action-gh-release@v2 | |
| if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' | |
| with: | |
| tag_name: v${{ env.NPS_VERSION }} | |
| files: "*.tar.gz" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| build_android: | |
| runs-on: ubuntu-latest | |
| env: | |
| API: '24' | |
| NDK_VERSION: 'r28c' | |
| steps: | |
| - name: Checkout codebase | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| check-latest: true | |
| id: go | |
| - name: Install build dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y curl unzip jq tar binutils | |
| - name: Set NDK cache dir from $HOME | |
| run: echo "NDK_CACHE_DIR=$HOME/ndk-cache" >> "$GITHUB_ENV" | |
| - name: Cache Android NDK | |
| id: cache-ndk | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ env.NDK_CACHE_DIR }}/android-ndk-${{ env.NDK_VERSION }} | |
| key: ndk-${{ runner.os }}-${{ env.NDK_VERSION }} | |
| - name: Get dependencies | |
| run: | | |
| go get -v -t -d ./... | |
| if [ -f Gopkg.toml ]; then | |
| curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh | |
| dep ensure | |
| fi | |
| - name: Build | |
| env: | |
| API: ${{ env.API }} | |
| NDK_VERSION: ${{ env.NDK_VERSION }} | |
| NDK_CACHE_DIR: ${{ env.NDK_CACHE_DIR }} | |
| NDK: ${{ env.NDK_CACHE_DIR }}/android-ndk-${{ env.NDK_VERSION }} | |
| run: | | |
| chmod +x build.android.sh | |
| ./build.android.sh | |
| ls -l android_libs_client.tar.gz || true | |
| - name: Get NPS version | |
| id: version | |
| run: | | |
| if [ -f "lib/version/version.go" ]; then | |
| version=$(grep -oP '(?<=const VERSION = ")[^"]*' lib/version/version.go) | |
| echo "NPS version: $version" | |
| echo "NPS_VERSION=$version" >> $GITHUB_ENV | |
| fi | |
| - name: Upload | |
| uses: softprops/action-gh-release@v2 | |
| if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' | |
| with: | |
| tag_name: v${{ env.NPS_VERSION }} | |
| files: "*.tar.gz" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Trigger Update NPS Client | |
| run: | | |
| curl -X POST https://api.github.com/repos/djylb/npsclient/dispatches \ | |
| -H "Accept: application/vnd.github+json" \ | |
| -H "Authorization: Bearer ${{ secrets.GH_PAT }}" \ | |
| -d '{"event_type":"trigger-update"}' |