2022-11-27 02:42:13 +08:00
|
|
|
---
|
|
|
|
kind: pipeline
|
|
|
|
name: build linux/amd64
|
|
|
|
steps:
|
|
|
|
- commands:
|
|
|
|
- git fetch --tags
|
|
|
|
image: alpine/git
|
|
|
|
name: fetch tags
|
|
|
|
- commands:
|
|
|
|
- go test -v ./...
|
|
|
|
image: golang:1.19
|
|
|
|
name: go test
|
|
|
|
- commands:
|
|
|
|
- DIST_DIR=$(mktemp -d)
|
|
|
|
- go build -v -trimpath -ldflags="-w -s -X main.AppVersion=$(git describe --tags
|
|
|
|
--always)" -o $DIST_DIR ./cmd/um
|
2022-11-27 07:45:44 +08:00
|
|
|
- tar cz -f dist/um-linux-amd64.tar.gz -C $DIST_DIR .
|
2022-11-27 02:42:13 +08:00
|
|
|
environment:
|
|
|
|
GOARCH: amd64
|
|
|
|
GOOS: linux
|
|
|
|
image: golang:1.19
|
|
|
|
name: go build
|
|
|
|
- commands:
|
2022-11-27 07:45:44 +08:00
|
|
|
- curl --fail --include --user "um-release-bot:$GITEA_API_KEY" --upload-file "dist/um-linux-amd64.tar.gz"
|
2022-11-27 02:42:13 +08:00
|
|
|
"$DRONE_GITEA_SERVER/api/packages/${DRONE_REPO_NAMESPACE}/generic/${DRONE_REPO_NAME}-build/${DRONE_BUILD_NUMBER}/um-linux-amd64.tar.gz"
|
2022-11-27 07:45:44 +08:00
|
|
|
- sha256sum dist/um-linux-amd64.tar.gz
|
2022-11-27 02:42:13 +08:00
|
|
|
- echo $DRONE_GITEA_SERVER/${DRONE_REPO_NAMESPACE}/-/packages/generic/${DRONE_REPO_NAME}-build/${DRONE_BUILD_NUMBER}
|
|
|
|
environment:
|
|
|
|
DRONE_GITEA_SERVER: https://git.unlock-music.dev
|
|
|
|
GITEA_API_KEY:
|
|
|
|
from_secret: GITEA_API_KEY
|
|
|
|
image: golang:1.19
|
|
|
|
name: upload artifact
|
|
|
|
trigger:
|
|
|
|
event:
|
|
|
|
- push
|
|
|
|
- pull_request
|
|
|
|
type: docker
|
|
|
|
---
|
|
|
|
kind: pipeline
|
|
|
|
name: build windows/amd64
|
|
|
|
steps:
|
|
|
|
- commands:
|
|
|
|
- git fetch --tags
|
|
|
|
image: alpine/git
|
|
|
|
name: fetch tags
|
|
|
|
- commands:
|
|
|
|
- DIST_DIR=$(mktemp -d)
|
|
|
|
- go build -v -trimpath -ldflags="-w -s -X main.AppVersion=$(git describe --tags
|
|
|
|
--always)" -o $DIST_DIR ./cmd/um
|
2022-11-27 07:45:44 +08:00
|
|
|
- tar cz -f dist/um-windows-amd64.tar.gz -C $DIST_DIR .
|
2022-11-27 02:42:13 +08:00
|
|
|
environment:
|
|
|
|
GOARCH: amd64
|
|
|
|
GOOS: windows
|
|
|
|
image: golang:1.19
|
|
|
|
name: go build
|
|
|
|
- commands:
|
2022-11-27 07:45:44 +08:00
|
|
|
- curl --fail --include --user "um-release-bot:$GITEA_API_KEY" --upload-file "dist/um-windows-amd64.tar.gz"
|
2022-11-27 02:42:13 +08:00
|
|
|
"$DRONE_GITEA_SERVER/api/packages/${DRONE_REPO_NAMESPACE}/generic/${DRONE_REPO_NAME}-build/${DRONE_BUILD_NUMBER}/um-windows-amd64.tar.gz"
|
2022-11-27 07:45:44 +08:00
|
|
|
- sha256sum dist/um-windows-amd64.tar.gz
|
2022-11-27 02:42:13 +08:00
|
|
|
- echo $DRONE_GITEA_SERVER/${DRONE_REPO_NAMESPACE}/-/packages/generic/${DRONE_REPO_NAME}-build/${DRONE_BUILD_NUMBER}
|
|
|
|
environment:
|
|
|
|
DRONE_GITEA_SERVER: https://git.unlock-music.dev
|
|
|
|
GITEA_API_KEY:
|
|
|
|
from_secret: GITEA_API_KEY
|
|
|
|
image: golang:1.19
|
|
|
|
name: upload artifact
|
|
|
|
trigger:
|
|
|
|
event:
|
|
|
|
- push
|
|
|
|
- pull_request
|
|
|
|
type: docker
|
|
|
|
---
|
|
|
|
kind: pipeline
|
|
|
|
name: build darwin/amd64
|
|
|
|
steps:
|
|
|
|
- commands:
|
|
|
|
- git fetch --tags
|
|
|
|
image: alpine/git
|
|
|
|
name: fetch tags
|
|
|
|
- commands:
|
|
|
|
- DIST_DIR=$(mktemp -d)
|
|
|
|
- go build -v -trimpath -ldflags="-w -s -X main.AppVersion=$(git describe --tags
|
|
|
|
--always)" -o $DIST_DIR ./cmd/um
|
2022-11-27 07:45:44 +08:00
|
|
|
- tar cz -f dist/um-darwin-amd64.tar.gz -C $DIST_DIR .
|
2022-11-27 02:42:13 +08:00
|
|
|
environment:
|
|
|
|
GOARCH: amd64
|
|
|
|
GOOS: darwin
|
|
|
|
image: golang:1.19
|
|
|
|
name: go build
|
|
|
|
- commands:
|
2022-11-27 07:45:44 +08:00
|
|
|
- curl --fail --include --user "um-release-bot:$GITEA_API_KEY" --upload-file "dist/um-darwin-amd64.tar.gz"
|
2022-11-27 02:42:13 +08:00
|
|
|
"$DRONE_GITEA_SERVER/api/packages/${DRONE_REPO_NAMESPACE}/generic/${DRONE_REPO_NAME}-build/${DRONE_BUILD_NUMBER}/um-darwin-amd64.tar.gz"
|
2022-11-27 07:45:44 +08:00
|
|
|
- sha256sum dist/um-darwin-amd64.tar.gz
|
2022-11-27 02:42:13 +08:00
|
|
|
- echo $DRONE_GITEA_SERVER/${DRONE_REPO_NAMESPACE}/-/packages/generic/${DRONE_REPO_NAME}-build/${DRONE_BUILD_NUMBER}
|
|
|
|
environment:
|
|
|
|
DRONE_GITEA_SERVER: https://git.unlock-music.dev
|
|
|
|
GITEA_API_KEY:
|
|
|
|
from_secret: GITEA_API_KEY
|
|
|
|
image: golang:1.19
|
|
|
|
name: upload artifact
|
|
|
|
trigger:
|
|
|
|
event:
|
|
|
|
- push
|
|
|
|
- pull_request
|
|
|
|
type: docker
|
2022-11-27 07:45:44 +08:00
|
|
|
---
|
|
|
|
kind: pipeline
|
|
|
|
name: release
|
|
|
|
steps:
|
|
|
|
- commands:
|
|
|
|
- git fetch --tags
|
|
|
|
image: alpine/git
|
|
|
|
name: fetch tags
|
|
|
|
- commands:
|
|
|
|
- go test -v ./...
|
|
|
|
image: golang:1.19
|
|
|
|
name: go test
|
|
|
|
- commands:
|
|
|
|
- DIST_DIR=$(mktemp -d)
|
|
|
|
- go build -v -trimpath -ldflags="-w -s -X main.AppVersion=$(git describe --tags
|
|
|
|
--always)" -o $DIST_DIR ./cmd/um
|
|
|
|
- tar cz -f dist/um-linux-amd64.tar.gz -C $DIST_DIR .
|
|
|
|
environment:
|
|
|
|
GOARCH: amd64
|
|
|
|
GOOS: linux
|
|
|
|
image: golang:1.19
|
|
|
|
name: go build
|
|
|
|
- commands:
|
|
|
|
- DIST_DIR=$(mktemp -d)
|
|
|
|
- go build -v -trimpath -ldflags="-w -s -X main.AppVersion=$(git describe --tags
|
|
|
|
--always)" -o $DIST_DIR ./cmd/um
|
|
|
|
- tar cz -f dist/um-linux-arm64.tar.gz -C $DIST_DIR .
|
|
|
|
environment:
|
|
|
|
GOARCH: arm64
|
|
|
|
GOOS: linux
|
|
|
|
image: golang:1.19
|
|
|
|
name: go build
|
|
|
|
- commands:
|
|
|
|
- DIST_DIR=$(mktemp -d)
|
|
|
|
- go build -v -trimpath -ldflags="-w -s -X main.AppVersion=$(git describe --tags
|
|
|
|
--always)" -o $DIST_DIR ./cmd/um
|
|
|
|
- tar cz -f dist/um-linux-386.tar.gz -C $DIST_DIR .
|
|
|
|
environment:
|
|
|
|
GOARCH: "386"
|
|
|
|
GOOS: linux
|
|
|
|
image: golang:1.19
|
|
|
|
name: go build
|
|
|
|
- commands:
|
|
|
|
- DIST_DIR=$(mktemp -d)
|
|
|
|
- go build -v -trimpath -ldflags="-w -s -X main.AppVersion=$(git describe --tags
|
|
|
|
--always)" -o $DIST_DIR ./cmd/um
|
|
|
|
- tar cz -f dist/um-windows-amd64.tar.gz -C $DIST_DIR .
|
|
|
|
environment:
|
|
|
|
GOARCH: amd64
|
|
|
|
GOOS: windows
|
|
|
|
image: golang:1.19
|
|
|
|
name: go build
|
|
|
|
- commands:
|
|
|
|
- DIST_DIR=$(mktemp -d)
|
|
|
|
- go build -v -trimpath -ldflags="-w -s -X main.AppVersion=$(git describe --tags
|
|
|
|
--always)" -o $DIST_DIR ./cmd/um
|
|
|
|
- tar cz -f dist/um-windows-386.tar.gz -C $DIST_DIR .
|
|
|
|
environment:
|
|
|
|
GOARCH: "386"
|
|
|
|
GOOS: windows
|
|
|
|
image: golang:1.19
|
|
|
|
name: go build
|
|
|
|
- commands:
|
|
|
|
- DIST_DIR=$(mktemp -d)
|
|
|
|
- go build -v -trimpath -ldflags="-w -s -X main.AppVersion=$(git describe --tags
|
|
|
|
--always)" -o $DIST_DIR ./cmd/um
|
|
|
|
- tar cz -f dist/um-darwin-amd64.tar.gz -C $DIST_DIR .
|
|
|
|
environment:
|
|
|
|
GOARCH: amd64
|
|
|
|
GOOS: darwin
|
|
|
|
image: golang:1.19
|
|
|
|
name: go build
|
|
|
|
- commands:
|
|
|
|
- DIST_DIR=$(mktemp -d)
|
|
|
|
- go build -v -trimpath -ldflags="-w -s -X main.AppVersion=$(git describe --tags
|
|
|
|
--always)" -o $DIST_DIR ./cmd/um
|
|
|
|
- tar cz -f dist/um-darwin-arm64.tar.gz -C $DIST_DIR .
|
|
|
|
environment:
|
|
|
|
GOARCH: arm64
|
|
|
|
GOOS: darwin
|
|
|
|
image: golang:1.19
|
|
|
|
name: go build
|
|
|
|
- image: plugins/gitea-release
|
|
|
|
name: create release
|
|
|
|
settings:
|
|
|
|
api_key:
|
|
|
|
from_secret: GITEA_API_KEY
|
|
|
|
base_url: https://git.unlock-music.dev
|
|
|
|
checksum: sha256
|
|
|
|
draft: true
|
|
|
|
files: dist/*
|
|
|
|
title: ${DRONE_TAG}
|
|
|
|
trigger:
|
|
|
|
event:
|
|
|
|
- tag
|
|
|
|
type: docker
|