update
This commit is contained in:
@@ -23,7 +23,7 @@ version:
|
||||
gobuild:
|
||||
variables:
|
||||
GOPROXY: https://nexus.durp.info/repository/go/
|
||||
extends: .golang-build-api
|
||||
extends: .golang-build
|
||||
stage: build
|
||||
|
||||
docker:
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#%%MULTILINE_YAML_START
|
||||
#Build golang api
|
||||
export GOPATH=/go
|
||||
export PATH=$PATH:$GOPATH/bin
|
||||
|
||||
mkdir output
|
||||
|
||||
go install
|
||||
go install github.com/swaggo/swag/cmd/swag@v1.8.12
|
||||
swag init
|
||||
|
||||
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o ./output/main .
|
||||
18
scripts/golang-build.sh
Normal file
18
scripts/golang-build.sh
Normal file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
#%%MULTILINE_YAML_START
|
||||
#Build golang project
|
||||
export GOPATH=/go
|
||||
export PATH=$PATH:$GOPATH/bin
|
||||
|
||||
mkdir output
|
||||
|
||||
go install
|
||||
|
||||
# Check if go.mod contains "swag"
|
||||
if grep -q "swag" go.mod; then
|
||||
echo "Found 'swag' in go.mod. Running swag init..."
|
||||
go install github.com/swaggo/swag/cmd/swag@v1.8.12
|
||||
swag init
|
||||
fi
|
||||
|
||||
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o ./output/main .
|
||||
@@ -1,9 +1,9 @@
|
||||
.golang-build-api:
|
||||
.golang-build:
|
||||
variables:
|
||||
#GOPROXY: https://nexus.durp.info/repository/go/
|
||||
image: registry.internal.durp.info/golang:${GO_VERSION}
|
||||
script:
|
||||
- ./scripts/golang-build-api.sh
|
||||
- ./scripts/golang-build.sh
|
||||
artifacts:
|
||||
expire_in: 1 hour
|
||||
paths:
|
||||
|
||||
Reference in New Issue
Block a user