Files
v2rayA/.github/workflows/pull_request.yml
T

56 lines
2.0 KiB
YAML

name: Pull Request Check
on:
pull_request:
types: [opened, synchronize, reopened]
paths:
- "**/*.go"
- "service/go.mod"
- "service/go.sum"
- "gui/**"
- ".github/workflows/*.yml"
jobs:
Build_v2rayA:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: lts/*
cache: 'yarn'
cache-dependency-path: gui/yarn.lock
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ^1.21
- name: Build v2rayA
run: |
mkdir v2raya_bin
CurrentDir="$(pwd)"
if [ -d "$CurrentDir/.git" ]; then
date=$(git -C "$CurrentDir" log -1 --format="%cd" --date=short | sed s/-//g)
count=$(git -C "$CurrentDir" rev-list --count HEAD)
commit=$(git -C "$CurrentDir" rev-parse --short HEAD)
version="unstable-$date.r${count}.$commit"
else
version="unstable"
fi
cd "$CurrentDir"/gui && yarn && OUTPUT_DIR="$CurrentDir"/service/server/router/web yarn build
find "$CurrentDir"/service/server/router/web \! -name \*.png -a \! -name \*.gz -a \! -name index.html -a ! -type d -exec gzip -9 {} +
cd "$CurrentDir"/service
for os in linux windows darwin; do
for arch in amd64 arm64; do
if [ "$os" = "windows" ]; then
GOOS="$os" GOARCH="$arch" CGO_ENABLED=0 go build -ldflags "-X github.com/v2rayA/v2rayA/conf.Version=$version -s -w" -o "$CurrentDir"/v2raya_bin/v2raya_pr_build_"$os"_"$arch"_"$version".exe
else
GOOS="$os" GOARCH="$arch" CGO_ENABLED=0 go build -ldflags "-X github.com/v2rayA/v2rayA/conf.Version=$version -s -w" -o "$CurrentDir"/v2raya_bin/v2raya_pr_build_"$os"_"$arch"_"$version"
fi
done
done
- name: Upload Zip File to Artifacts
uses: nanoufo/action-upload-artifacts-and-release-assets@v1.8
with:
path: v2raya_bin/*