mc-tgbot/.drone.yml
vaalacat 80cae65b98
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/promote/production Build is passing
fix: unbind
2024-04-28 03:53:12 +00:00

126 lines
3.3 KiB
YAML

kind: pipeline
name: build-and-publish
steps:
- name: download modules
image: git.vaala.cloud/vaalacat/golang:1.20.0-alpine3.17
commands:
- sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories
- apk update --no-cache && apk add --no-cache tzdata git
- GOPRIVATE=git.vaala.cloud CGO_ENABLED=0 GOPROXY=https://goproxy.cn,https://proxy.golang.org,direct go mod download
- mkdir -p etc
- cp /etc/ssl/certs/ca-certificates.crt ./etc/ca-certificates.crt
- cp /usr/share/zoneinfo/Asia/Shanghai ./etc/Shanghai
volumes:
- name: gocache
path: /go/pkg/mod
- name: build
path: /tmp/app
when:
event:
- pull_request
- promote
- rollback
- name: build - amd64
image: git.vaala.cloud/vaalacat/golang:1.20.0-alpine3.17
commands:
- GOOS=linux GOARCH=amd64 GOPRIVATE=git.vaala.cloud CGO_ENABLED=0 GOPROXY=https://goproxy.cn,https://proxy.golang.org,direct go build -ldflags="-s -w" -o mcbot-amd64 main.go
volumes:
- name: gocache
path: /go/pkg/mod
- name: build
path: /tmp/app
depends_on:
- download modules
when:
event:
- pull_request
- promote
- rollback
- name: build - arm64
image: git.vaala.cloud/vaalacat/golang:1.20.0-alpine3.17
commands:
- GOOS=linux GOARCH=arm64 GOPRIVATE=git.vaala.cloud CGO_ENABLED=0 GOPROXY=https://goproxy.cn,https://proxy.golang.org,direct go build -ldflags="-s -w" -o mcbot-arm64 main.go
volumes:
- name: gocache
path: /go/pkg/mod
- name: build
path: /tmp/app
depends_on:
- download modules
when:
event:
- pull_request
- promote
- rollback
- name: publish - amd64
image: git.vaala.cloud/vaalacat/drone-docker-buildx:24
privileged: true
environment:
HTTP_PROXY:
from_secret: HTTP_PROXY
HTTPS_PROXY:
from_secret: HTTP_PROXY
settings:
mirror: https://docker.lab.vaala.tech
debug: true
platforms:
- linux/amd64
build_args:
- ARCH=amd64
repo: git.vaala.cloud/vaalacat/mcbot
tags:
- amd64
registry:
from_secret: docker_registry
username:
from_secret: docker_username
password:
from_secret: docker_password
depends_on:
- build - amd64
when:
event:
- promote
- rollback
target:
- production
- name: publish - arm64
image: git.vaala.cloud/vaalacat/drone-docker-buildx:24
privileged: true
environment:
HTTP_PROXY:
from_secret: HTTP_PROXY
HTTPS_PROXY:
from_secret: HTTP_PROXY
settings:
mirror: https://docker.lab.vaala.tech
debug: true
platforms:
- linux/arm64
build_args:
- ARCH=arm64
repo: git.vaala.cloud/vaalacat/mcbot
tags:
- arm64
registry:
from_secret: docker_registry
username:
from_secret: docker_username
password:
from_secret: docker_password
depends_on:
- build - arm64
when:
event:
- promote
- rollback
target:
- production
volumes:
- name: build
temp: {}
- name: gocache
host:
path: /tmp/drone/mcbot/gocache