mirror of
https://github.com/ngoduykhanh/wireguard-ui.git
synced 2025-04-19 19:59:13 +03:00
Update Gitlab workflow
This commit is contained in:
parent
c8b1ca04ac
commit
f05236b632
2 changed files with 43 additions and 114 deletions
127
.github/workflows/release.yml
vendored
127
.github/workflows/release.yml
vendored
|
@ -1,87 +1,46 @@
|
|||
on: release
|
||||
name: Build Release
|
||||
on:
|
||||
release:
|
||||
types: [created]
|
||||
|
||||
jobs:
|
||||
release-linux-386:
|
||||
name: release linux/386
|
||||
releases-matrix:
|
||||
name: Release Go Binary
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
# build and publish in parallel: linux/386, linux/amd64, windows/386, windows/amd64, darwin/386, darwin/amd64
|
||||
goos: [linux, windows, darwin]
|
||||
goarch: ["386", amd64]
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- name: compile and release
|
||||
uses: ngs/go-release.action@v1.0.1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GOARCH: "386"
|
||||
GOOS: linux
|
||||
CMD_PATH: "-a -o wg-ui"
|
||||
release-linux-amd64:
|
||||
name: release linux/amd64
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- name: compile and release
|
||||
uses: ngs/go-release.action@v1.0.1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GOARCH: amd64
|
||||
GOOS: linux
|
||||
CMD_PATH: "-a -o wg-ui"
|
||||
release-linux-arm:
|
||||
name: release linux/386
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- name: compile and release
|
||||
uses: ngs/go-release.action@v1.0.1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GOARCH: "arm"
|
||||
GOOS: linux
|
||||
CMD_PATH: "-a -o wg-ui"
|
||||
release-linux-arm64:
|
||||
name: release linux/amd64
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- name: compile and release
|
||||
uses: ngs/go-release.action@v1.0.1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GOARCH: arm64
|
||||
GOOS: linux
|
||||
CMD_PATH: "-a -o wg-ui"
|
||||
release-darwin-amd64:
|
||||
name: release darwin/amd64
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- name: compile and release
|
||||
uses: ngs/go-release.action@v1.0.1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GOARCH: amd64
|
||||
GOOS: darwin
|
||||
CMD_PATH: "-a -o wg-ui"
|
||||
release-windows-386:
|
||||
name: release windows/386
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- name: compile and release
|
||||
uses: ngs/go-release.action@v1.0.1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GOARCH: "386"
|
||||
GOOS: windows
|
||||
CMD_PATH: "-a -o wg-ui"
|
||||
release-windows-amd64:
|
||||
name: release windows/amd64
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- name: compile and release
|
||||
uses: ngs/go-release.action@v1.0.1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GOARCH: amd64
|
||||
GOOS: windows
|
||||
CMD_PATH: "-a -o wg-ui"
|
||||
# get the source code
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
# set environment
|
||||
- name: Set APP_VERSION env
|
||||
run: echo ::set-env name=APP_VERSION::$(echo ${GITHUB_REF} | rev | cut -d'/' -f 1 | rev )
|
||||
- name: Set BUILD_TIME env
|
||||
run: echo ::set-env name=BUILD_TIME::$(date)
|
||||
- name: Environment Printer
|
||||
uses: managedkaos/print-env@v1.0
|
||||
|
||||
# execute yarn install
|
||||
- uses: borales/actions-yarn@v2.0.0
|
||||
with:
|
||||
cmd: install
|
||||
|
||||
- name: Prepare aseets
|
||||
run: |
|
||||
chmod +x ./prepare_assets.sh
|
||||
./prepare_assets.sh
|
||||
|
||||
# build and make the releases
|
||||
- uses: wangyoucao577/go-release-action@master
|
||||
with:
|
||||
pre_command: "go get github.com/GeertJohan/go.rice/rice && rice embed-go"
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
goos: ${{ matrix.goos }}
|
||||
goarch: ${{ matrix.goarch }}
|
||||
goversion: "https://dl.google.com/go/go1.14.2.linux-amd64.tar.gz"
|
||||
binary_name: "wireguard-ui"
|
||||
build_flags: -v
|
||||
ldflags: -X "main.appVersion=${{ env.APP_VERSION }}" -X "main.buildTime=${{ env.BUILD_TIME }}" -X main.gitCommit=${{ github.sha }} -X main.gitRef=${{ github.ref }}
|
||||
|
|
30
build.sh
30
build.sh
|
@ -1,30 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -eux
|
||||
|
||||
PROJECT_ROOT="/go/src/github.com/${GITHUB_REPOSITORY}"
|
||||
|
||||
mkdir -p $PROJECT_ROOT
|
||||
rmdir $PROJECT_ROOT
|
||||
ln -s $GITHUB_WORKSPACE $PROJECT_ROOT
|
||||
cd $PROJECT_ROOT
|
||||
|
||||
sh ./prepare_assets.sh
|
||||
go mod download
|
||||
go get github.com/GeertJohan/go.rice/rice
|
||||
rice embed-go
|
||||
|
||||
EXT=''
|
||||
|
||||
if [ $GOOS == 'windows' ]; then
|
||||
EXT='.exe'
|
||||
fi
|
||||
|
||||
if [ -x "./build.sh" ]; then
|
||||
OUTPUT=`./build.sh "${CMD_PATH}"`
|
||||
else
|
||||
go build "${CMD_PATH}"
|
||||
OUTPUT="${PROJECT_NAME}${EXT}"
|
||||
fi
|
||||
|
||||
echo ${OUTPUT}
|
Loading…
Add table
Reference in a new issue