Skip to content

v1.3.2自动构建项目捆绑v2ray可执行文件v5.14.1 #3

v1.3.2自动构建项目捆绑v2ray可执行文件v5.14.1

v1.3.2自动构建项目捆绑v2ray可执行文件v5.14.1 #3

Workflow file for this run

# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: CreateRelease
on:
release:
types:
- prereleased
- released
# push:
# tags:
# - "v*"
jobs:
build:
strategy:
matrix:
goos: [linux, darwin, windows]
goarch: [amd64, 386]
# filesuf: ['.exe', '']
exclude:
- goarch: 386
goos: darwin
# - filesuf: ''
# goos: windows
# - filesuf: '.exe'
# goos: [linux, darwin]
permissions: # 需要设置写权限才能自动发布
contents: write
runs-on: ubuntu-latest
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: 0
steps:
- uses: actions/checkout@master
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.22.x'
- name: Install dependencies
run: |
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,direct
go mod tidy
- name: Get File Name
id: get_filename
run: |
export _NAME=v2raypool-${{ matrix.goos }}-${{ matrix.goarch }}
echo "GOOS: $GOOS, GOARCH: $GOARCH, RELEASE_NAME: $_NAME"
echo "ASSET_NAME=$_NAME" >> $GITHUB_OUTPUT
echo "ASSET_NAME=$_NAME" >> $GITHUB_ENV
- name: Build
run: |
mkdir -p build_assets
go build -v -o build_assets/v2raypool -trimpath -ldflags "-s -w -buildid=" ./main
- name: Rename Windows File
if: matrix.goos == 'windows'
run: |
cd ./build_assets || exit 1
mv v2raypool v2raypool.exe
- name: Download geo files
run: |
wget -O main/bin/geoip.dat "https://raw.githubusercontent.com/v2fly/geoip/release/geoip.dat"
wget -O main/bin/geoip-only-cn-private.dat "https://raw.githubusercontent.com/v2fly/geoip/release/geoip-only-cn-private.dat"
wget -O main/bin/geosite.dat "https://raw.githubusercontent.com/v2fly/domain-list-community/release/dlc.dat"
- name: Prepare package
run: |
cp -rv ./main/resource ./build_assets/
cp -rv ./main/bin ./build_assets/
touch ./build_assets/subscribe_data.txt
- name: Package
run: tar zcvf ${{ steps.get_filename.outputs.ASSET_NAME }}.tar.gz ./build_assets
# 上传附件
- name: Upload file to Artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ steps.get_filename.outputs.ASSET_NAME }}.tar.gz
path: ${{ steps.get_filename.outputs.ASSET_NAME }}.tar.gz
# - name: Create Release
# id: create_release
# uses: actions/create-release@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# tag_name: ${{ github.event.release.tag_name }}
# release_name: Release ${{ github.ref }}
# body: Please refer to [CHANGELOG.md](https://github.com/iotames/v2raypool/blob/master/CHANGELOG.md) for details.
# draft: false
# prerelease: false
- name: Upload files to GitHub release
uses: svenstaro/upload-release-action@v2
if: github.event_name == 'release'
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file_glob: true
file: ./${{ steps.get_filename.outputs.ASSET_NAME }}.tar.gz
tag: ${{ github.ref }}
overwrite: true
# - name: Upload Release Asset
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ steps.create_release.outputs.upload_url }}
# asset_path: ${{ steps.get_filename.outputs.ASSET_NAME }}.tar.gz
# asset_name: ${{ steps.get_filename.outputs.ASSET_NAME }}.tar.gz
# asset_content_type: application/zip