Skip to content

Commit

Permalink
update action
Browse files Browse the repository at this point in the history
  • Loading branch information
710leo committed Apr 14, 2020
1 parent 3dc69b7 commit ec69dbf
Showing 1 changed file with 11 additions and 33 deletions.
44 changes: 11 additions & 33 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -1,48 +1,26 @@
name: Go
on: [push]

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:

build:
name: Build
runs-on: ubuntu-latest
steps:

- name: Set up Go 1.12
- name: Set up Go 1.13
uses: actions/setup-go@v1
with:
go-version: 1.12
go-version: 1.13
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v1
uses: actions/checkout@v2

- name: Build
run: |
pwd
origin=$PWD
complete_path="github.com/710leo"
app="urlooker"
if [ "$PWD" != "$GOPATH/src/$complete_path/$app" ]; then
# 如果没有设置GOPATH,则在上层目录创建build目录来作为GOPATH
if [ ! -d "$GOPATH" ]; then
cd ..
if [ ! -d "build" ]; then
mkdir -p "build"
fi
cd build
export GOPATH="$PWD"
fi
# 如果GOPATH下已经存在当前项目, 则备份
if [ -d "$GOPATH/src/$complete_path/$app" ]; then
mv "$GOPATH/src/$complete_path/$app" "$GOPATH/src/$complete_path/$app.$(date +%Y%m%d%H%M%S)"
fi
# 如果GOPATH下不存在当前项目标准路径,创建,并且软链接过去
if [ ! -d "$GOPATH/src/$complete_path" ]; then
mkdir -p "$GOPATH/src/$complete_path"
fi
ln -sf "$origin" "$GOPATH/src/$complete_path/$app"
cd "$GOPATH/src/$complete_path/$app"
fi
cd "$GOPATH/src/$complete_path/$app"
go get -v -d ./...
./control.sh build
run: ./control build

0 comments on commit ec69dbf

Please sign in to comment.