github.com/v2fly/v2ray-core/v4@v4.45.2/.github/workflows/release.yml (about) 1 name: Release 2 3 on: 4 release: 5 types: [prereleased] 6 push: 7 branches: 8 - master 9 - v* 10 - dev* 11 paths: 12 - "**/*.go" 13 - "go.mod" 14 - "go.sum" 15 - ".github/workflows/*.yml" 16 pull_request: 17 types: [opened, synchronize, reopened] 18 paths: 19 - "**/*.go" 20 - "go.mod" 21 - "go.sum" 22 - ".github/workflows/*.yml" 23 24 jobs: 25 build: 26 strategy: 27 matrix: 28 # Include amd64 on all platforms. 29 goos: [windows, freebsd, openbsd, linux, dragonfly, darwin] 30 goarch: [amd64, 386] 31 exclude: 32 # Exclude i386 on darwin and dragonfly. 33 - goarch: 386 34 goos: dragonfly 35 - goarch: 386 36 goos: darwin 37 include: 38 # BEGIN Linux ARM 5 6 7 39 - goos: linux 40 goarch: arm 41 goarm: 7 42 - goos: linux 43 goarch: arm 44 goarm: 6 45 - goos: linux 46 goarch: arm 47 goarm: 5 48 # END Linux ARM 5 6 7 49 # Windows ARM 7 50 - goos: windows 51 goarch: arm 52 goarm: 7 53 # BEGIN Other architectures 54 - goos: darwin 55 goarch: arm64 56 - goos: linux 57 goarch: arm64 58 - goos: linux 59 goarch: riscv64 60 - goos: windows 61 goarch: arm64 62 # BEGIN MIPS 63 - goos: linux 64 goarch: mips64 65 - goos: linux 66 goarch: mips64le 67 - goos: linux 68 goarch: mipsle 69 - goos: linux 70 goarch: mips 71 # END MIPS 72 # BEGIN Android 73 - goos: android 74 goarch: arm64 75 # END Android 76 # END Other architectures 77 fail-fast: false 78 79 runs-on: ubuntu-latest 80 env: 81 GOOS: ${{ matrix.goos }} 82 GOARCH: ${{ matrix.goarch }} 83 GOARM: ${{ matrix.goarm }} 84 CGO_ENABLED: 0 85 86 steps: 87 - name: Checkout codebase 88 uses: actions/checkout@v2 89 with: 90 fetch-depth: 0 91 92 - name: Show workflow information 93 id: get_filename 94 run: | 95 export _NAME=$(jq ".[\"$GOOS-$GOARCH$GOARM\"].friendlyName" -r < release/friendly-filenames.json) 96 echo "GOOS: $GOOS, GOARCH: $GOARCH, GOARM: $GOARM, RELEASE_NAME: $_NAME" 97 echo "::set-output name=ASSET_NAME::$_NAME" 98 echo "ASSET_NAME=$_NAME" >> $GITHUB_ENV 99 100 - name: Set up Go 101 uses: actions/setup-go@v2 102 with: 103 go-version: ^1.17 104 105 - name: Get project dependencies 106 run: go mod download 107 108 - name: Build V2Ray 109 run: | 110 mkdir -p build_assets 111 go build -v -o build_assets/v2ray -trimpath -ldflags "-s -w -buildid=" ./main 112 go build -v -o build_assets/v2ctl -trimpath -ldflags "-s -w -buildid=" -tags confonly ./infra/control/main 113 114 - name: Build Windows wv2ray 115 if: matrix.goos == 'windows' 116 run: | 117 echo "::warning ::wv2ray.exe will be removed in v5" 118 go build -v -o build_assets/wv2ray.exe -trimpath -ldflags "-s -w -H windowsgui -buildid=" ./main 119 cd ./build_assets || exit 1 120 mv v2ray v2ray.exe 121 mv v2ctl v2ctl.exe 122 123 - name: Download geo files 124 run: | 125 wget -O release/config/geoip.dat "https://raw.githubusercontent.com/v2fly/geoip/release/geoip.dat" 126 wget -O release/config/geoip-only-cn-private.dat "https://raw.githubusercontent.com/v2fly/geoip/release/geoip-only-cn-private.dat" 127 wget -O release/config/geosite.dat "https://raw.githubusercontent.com/v2fly/domain-list-community/release/dlc.dat" 128 129 - name: Prepare package 130 run: cp -v ./release/config/*.* ./build_assets 131 132 - name: Prepare package for Linux 133 if: matrix.goos == 'linux' 134 run: cp -rv ./release/config/systemd ./build_assets/ 135 136 - name: Create ZIP archive 137 run: | 138 pushd build_assets || exit 1 139 zip -9vr ../v2ray-$ASSET_NAME.zip . 140 popd || exit 1 141 FILE=./v2ray-$ASSET_NAME.zip 142 DGST=$FILE.dgst 143 openssl dgst -md5 $FILE | sed 's/([^)]*)//g' >>$DGST 144 openssl dgst -sha1 $FILE | sed 's/([^)]*)//g' >>$DGST 145 openssl dgst -sha256 $FILE | sed 's/([^)]*)//g' >>$DGST 146 openssl dgst -sha512 $FILE | sed 's/([^)]*)//g' >>$DGST 147 148 - name: Upload ZIP file to Artifacts 149 uses: actions/upload-artifact@v2 150 with: 151 name: v2ray-${{ steps.get_filename.outputs.ASSET_NAME }}.zip 152 path: v2ray-${{ steps.get_filename.outputs.ASSET_NAME }}.zip 153 154 - name: Upload files to GitHub release 155 uses: svenstaro/upload-release-action@v2 156 if: github.event_name == 'release' 157 with: 158 repo_token: ${{ secrets.GITHUB_TOKEN }} 159 file_glob: true 160 file: ./v2ray-${{ steps.get_filename.outputs.ASSET_NAME }}.zip* 161 tag: ${{ github.ref }} 162 163 signature: 164 runs-on: ubuntu-latest 165 needs: build 166 steps: 167 - name: Checkout codebase 168 uses: actions/checkout@v2 169 with: 170 fetch-depth: 0 171 172 - name: Set up Go 173 uses: actions/setup-go@v2 174 with: 175 go-version: ^1.17 176 177 - uses: actions/download-artifact@v2 178 with: 179 path: build_artifacts 180 181 - name: Create extra package 182 run: | 183 pushd ./release/extra/ 184 zip -9vr ../../build_artifacts/v2ray-extra.zip . 185 popd 186 187 - name: Generate shasum 188 run: | 189 go get -v github.com/v2fly/V2BuildAssist/v2buildutil 190 cd build_artifacts || exit 1 191 mkdir .temp 192 mv ./*/*.zip ./.temp 193 rmdir ./*/ 194 mv ./.temp/* . 195 ls -lah --recursive 196 { 197 go run github.com/v2fly/V2BuildAssist/v2buildutil gen version $(git describe --tags $(git rev-list --tags --max-count=1)) 198 go run github.com/v2fly/V2BuildAssist/v2buildutil gen project "v2fly" 199 for zip in $(ls *.zip); do 200 go run github.com/v2fly/V2BuildAssist/v2buildutil gen file ${zip} 201 done 202 } >Release.unsigned.unsorted 203 go run github.com/v2fly/V2BuildAssist/v2buildutil gen sort < Release.unsigned.unsorted > Release.unsigned 204 rm -f Release.unsigned.unsorted 205 FILE=./Release.unsigned 206 DGST=$FILE.dgst 207 openssl dgst -md5 $FILE | sed 's/([^)]*)//g' >>$DGST 208 openssl dgst -sha1 $FILE | sed 's/([^)]*)//g' >>$DGST 209 openssl dgst -sha256 $FILE | sed 's/([^)]*)//g' >>$DGST 210 openssl dgst -sha512 $FILE | sed 's/([^)]*)//g' >>$DGST 211 212 - uses: actions/upload-artifact@v2 213 with: 214 name: Release.unsigned 215 path: build_artifacts/Release.unsigned 216 217 - uses: actions/upload-artifact@v2 218 with: 219 name: Release.unsigned.dgst 220 path: build_artifacts/Release.unsigned.dgst 221 222 - uses: actions/upload-artifact@v2 223 with: 224 name: v2ray-extra.zip 225 path: build_artifacts/v2ray-extra.zip 226 227 - name: Upload Release.unsigned related files 228 uses: svenstaro/upload-release-action@v2 229 if: github.event_name == 'release' 230 with: 231 repo_token: ${{ secrets.GITHUB_TOKEN }} 232 file_glob: true 233 file: build_artifacts/Release.unsigned* 234 tag: ${{ github.ref }} 235 236 - name: Upload extra package 237 uses: svenstaro/upload-release-action@v2 238 if: github.event_name == 'release' 239 with: 240 repo_token: ${{ secrets.GITHUB_TOKEN }} 241 file_glob: true 242 file: build_artifacts/v2ray-extra.zip 243 tag: ${{ github.ref }}