Compare commits
2 Commits
604ee6ed1b
...
57c1aa3e54
Author | SHA1 | Date | |
---|---|---|---|
57c1aa3e54 | |||
b0998d8c8a |
@ -17,11 +17,13 @@ local CreateRelease() = {
|
||||
|
||||
|
||||
local StepGoBuild(GOOS, GOARCH) = {
|
||||
local archiveExt = if GOOS == 'windows' then 'zip' else 'tar.gz',
|
||||
local windows = GOOS == 'windows',
|
||||
local archiveExt = if windows then 'zip' else 'tar.gz',
|
||||
local filepath = 'dist/um-%s-%s.%s' % [GOOS, GOARCH, archiveExt],
|
||||
|
||||
// run zip or tar command depending on GOOS been windows or other
|
||||
local archive = if GOOS == 'windows' then [
|
||||
local archive = if windows then [
|
||||
// Ensure zip is installed
|
||||
'command -v zip >/dev/null || (apt update && apt install -y zip)',
|
||||
'zip -9 -j -r "%s" $DIST_DIR' % filepath,
|
||||
] else [
|
||||
'tar -zc -C $DIST_DIR um | gzip -9 > "%s"' % filepath,
|
||||
|
400
.drone.yml
400
.drone.yml
@ -1,225 +1,229 @@
|
||||
---
|
||||
kind: pipeline
|
||||
name: build linux/amd64
|
||||
steps:
|
||||
- commands:
|
||||
- git fetch --tags
|
||||
image: alpine/git
|
||||
name: fetch tags
|
||||
- commands:
|
||||
- go test -v ./...
|
||||
environment:
|
||||
GOPROXY: https://goproxy.io,direct
|
||||
image: golang:1.22
|
||||
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
|
||||
- mkdir -p dist
|
||||
- tar -zc -C $DIST_DIR um | gzip -9 > "dist/um-linux-amd64.tar.gz"
|
||||
environment:
|
||||
GOARCH: amd64
|
||||
GOOS: linux
|
||||
GOPROXY: https://goproxy.io,direct
|
||||
image: golang:1.22
|
||||
name: go build linux/amd64
|
||||
- commands:
|
||||
- curl --fail --include --user "um-release-bot:$GITEA_API_KEY" --upload-file
|
||||
"dist/um-linux-amd64.tar.gz" "$DRONE_GITEA_SERVER/api/packages/${DRONE_REPO_NAMESPACE}/generic/${DRONE_REPO_NAME}-build/${DRONE_BUILD_NUMBER}/um-linux-amd64.tar.gz"
|
||||
- sha256sum dist/um-linux-amd64.tar.gz
|
||||
- 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.22
|
||||
name: upload artifact
|
||||
- commands:
|
||||
- git fetch --tags
|
||||
image: alpine/git
|
||||
name: fetch tags
|
||||
- commands:
|
||||
- go test -v ./...
|
||||
environment:
|
||||
GOPROXY: https://goproxy.io,direct
|
||||
image: golang:1.22
|
||||
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
|
||||
- mkdir -p dist
|
||||
- tar -zc -C $DIST_DIR um | gzip -9 > "dist/um-linux-amd64.tar.gz"
|
||||
environment:
|
||||
GOARCH: amd64
|
||||
GOOS: linux
|
||||
GOPROXY: https://goproxy.io,direct
|
||||
image: golang:1.22
|
||||
name: go build linux/amd64
|
||||
- commands:
|
||||
- curl --fail --include --user "um-release-bot:$GITEA_API_KEY" --upload-file "dist/um-linux-amd64.tar.gz"
|
||||
"$DRONE_GITEA_SERVER/api/packages/${DRONE_REPO_NAMESPACE}/generic/${DRONE_REPO_NAME}-build/${DRONE_BUILD_NUMBER}/um-linux-amd64.tar.gz"
|
||||
- sha256sum dist/um-linux-amd64.tar.gz
|
||||
- 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.22
|
||||
name: upload artifact
|
||||
trigger:
|
||||
event:
|
||||
- push
|
||||
- pull_request
|
||||
- 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
|
||||
- mkdir -p dist
|
||||
- zip -9 -j -r "dist/um-windows-amd64.zip" $DIST_DIR
|
||||
environment:
|
||||
GOARCH: amd64
|
||||
GOOS: windows
|
||||
GOPROXY: https://goproxy.io,direct
|
||||
image: golang:1.22
|
||||
name: go build windows/amd64
|
||||
- commands:
|
||||
- curl --fail --include --user "um-release-bot:$GITEA_API_KEY" --upload-file
|
||||
"dist/um-windows-amd64.tar.gz" "$DRONE_GITEA_SERVER/api/packages/${DRONE_REPO_NAMESPACE}/generic/${DRONE_REPO_NAME}-build/${DRONE_BUILD_NUMBER}/um-windows-amd64.tar.gz"
|
||||
- sha256sum dist/um-windows-amd64.tar.gz
|
||||
- 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.22
|
||||
name: upload artifact
|
||||
- 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
|
||||
- mkdir -p dist
|
||||
- command -v zip >/dev/null || (apt update && apt install -y zip)
|
||||
- zip -9 -j -r "dist/um-windows-amd64.zip" $DIST_DIR
|
||||
environment:
|
||||
GOARCH: amd64
|
||||
GOOS: windows
|
||||
GOPROXY: https://goproxy.io,direct
|
||||
image: golang:1.22
|
||||
name: go build windows/amd64
|
||||
- commands:
|
||||
- curl --fail --include --user "um-release-bot:$GITEA_API_KEY" --upload-file "dist/um-windows-amd64.tar.gz"
|
||||
"$DRONE_GITEA_SERVER/api/packages/${DRONE_REPO_NAMESPACE}/generic/${DRONE_REPO_NAME}-build/${DRONE_BUILD_NUMBER}/um-windows-amd64.tar.gz"
|
||||
- sha256sum dist/um-windows-amd64.tar.gz
|
||||
- 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.22
|
||||
name: upload artifact
|
||||
trigger:
|
||||
event:
|
||||
- push
|
||||
- pull_request
|
||||
- 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
|
||||
- mkdir -p dist
|
||||
- tar -zc -C $DIST_DIR um | gzip -9 > "dist/um-darwin-amd64.tar.gz"
|
||||
environment:
|
||||
GOARCH: amd64
|
||||
GOOS: darwin
|
||||
GOPROXY: https://goproxy.io,direct
|
||||
image: golang:1.22
|
||||
name: go build darwin/amd64
|
||||
- commands:
|
||||
- curl --fail --include --user "um-release-bot:$GITEA_API_KEY" --upload-file
|
||||
"dist/um-darwin-amd64.tar.gz" "$DRONE_GITEA_SERVER/api/packages/${DRONE_REPO_NAMESPACE}/generic/${DRONE_REPO_NAME}-build/${DRONE_BUILD_NUMBER}/um-darwin-amd64.tar.gz"
|
||||
- sha256sum dist/um-darwin-amd64.tar.gz
|
||||
- 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.22
|
||||
name: upload artifact
|
||||
- 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
|
||||
- mkdir -p dist
|
||||
- tar -zc -C $DIST_DIR um | gzip -9 > "dist/um-darwin-amd64.tar.gz"
|
||||
environment:
|
||||
GOARCH: amd64
|
||||
GOOS: darwin
|
||||
GOPROXY: https://goproxy.io,direct
|
||||
image: golang:1.22
|
||||
name: go build darwin/amd64
|
||||
- commands:
|
||||
- curl --fail --include --user "um-release-bot:$GITEA_API_KEY" --upload-file "dist/um-darwin-amd64.tar.gz"
|
||||
"$DRONE_GITEA_SERVER/api/packages/${DRONE_REPO_NAMESPACE}/generic/${DRONE_REPO_NAME}-build/${DRONE_BUILD_NUMBER}/um-darwin-amd64.tar.gz"
|
||||
- sha256sum dist/um-darwin-amd64.tar.gz
|
||||
- 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.22
|
||||
name: upload artifact
|
||||
trigger:
|
||||
event:
|
||||
- push
|
||||
- pull_request
|
||||
- push
|
||||
- pull_request
|
||||
type: docker
|
||||
---
|
||||
kind: pipeline
|
||||
name: release
|
||||
steps:
|
||||
- commands:
|
||||
- git fetch --tags
|
||||
image: alpine/git
|
||||
name: fetch tags
|
||||
- commands:
|
||||
- go test -v ./...
|
||||
environment:
|
||||
GOPROXY: https://goproxy.io,direct
|
||||
image: golang:1.22
|
||||
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
|
||||
- mkdir -p dist
|
||||
- tar -zc -C $DIST_DIR um | gzip -9 > "dist/um-linux-amd64.tar.gz"
|
||||
environment:
|
||||
GOARCH: amd64
|
||||
GOOS: linux
|
||||
GOPROXY: https://goproxy.io,direct
|
||||
image: golang:1.22
|
||||
name: go build linux/amd64
|
||||
- commands:
|
||||
- DIST_DIR=$(mktemp -d)
|
||||
- go build -v -trimpath -ldflags="-w -s -X main.AppVersion=$(git describe --tags
|
||||
--always)" -o $DIST_DIR ./cmd/um
|
||||
- mkdir -p dist
|
||||
- tar -zc -C $DIST_DIR um | gzip -9 > "dist/um-linux-arm64.tar.gz"
|
||||
environment:
|
||||
GOARCH: arm64
|
||||
GOOS: linux
|
||||
GOPROXY: https://goproxy.io,direct
|
||||
image: golang:1.22
|
||||
name: go build linux/arm64
|
||||
- commands:
|
||||
- DIST_DIR=$(mktemp -d)
|
||||
- go build -v -trimpath -ldflags="-w -s -X main.AppVersion=$(git describe --tags
|
||||
--always)" -o $DIST_DIR ./cmd/um
|
||||
- mkdir -p dist
|
||||
- tar -zc -C $DIST_DIR um | gzip -9 > "dist/um-linux-386.tar.gz"
|
||||
environment:
|
||||
GOARCH: '386'
|
||||
GOOS: linux
|
||||
GOPROXY: https://goproxy.io,direct
|
||||
image: golang:1.22
|
||||
name: go build linux/386
|
||||
- commands:
|
||||
- DIST_DIR=$(mktemp -d)
|
||||
- go build -v -trimpath -ldflags="-w -s -X main.AppVersion=$(git describe --tags
|
||||
--always)" -o $DIST_DIR ./cmd/um
|
||||
- mkdir -p dist
|
||||
- zip -9 -j -r "dist/um-windows-amd64.zip" $DIST_DIR
|
||||
environment:
|
||||
GOARCH: amd64
|
||||
GOOS: windows
|
||||
GOPROXY: https://goproxy.io,direct
|
||||
image: golang:1.22
|
||||
name: go build windows/amd64
|
||||
- commands:
|
||||
- DIST_DIR=$(mktemp -d)
|
||||
- go build -v -trimpath -ldflags="-w -s -X main.AppVersion=$(git describe --tags
|
||||
--always)" -o $DIST_DIR ./cmd/um
|
||||
- mkdir -p dist
|
||||
- zip -9 -j -r "dist/um-windows-386.zip" $DIST_DIR
|
||||
environment:
|
||||
GOARCH: '386'
|
||||
GOOS: windows
|
||||
GOPROXY: https://goproxy.io,direct
|
||||
image: golang:1.22
|
||||
name: go build windows/386
|
||||
- commands:
|
||||
- DIST_DIR=$(mktemp -d)
|
||||
- go build -v -trimpath -ldflags="-w -s -X main.AppVersion=$(git describe --tags
|
||||
--always)" -o $DIST_DIR ./cmd/um
|
||||
- mkdir -p dist
|
||||
- tar -zc -C $DIST_DIR um | gzip -9 > "dist/um-darwin-amd64.tar.gz"
|
||||
environment:
|
||||
GOARCH: amd64
|
||||
GOOS: darwin
|
||||
GOPROXY: https://goproxy.io,direct
|
||||
image: golang:1.22
|
||||
name: go build darwin/amd64
|
||||
- commands:
|
||||
- DIST_DIR=$(mktemp -d)
|
||||
- go build -v -trimpath -ldflags="-w -s -X main.AppVersion=$(git describe --tags
|
||||
--always)" -o $DIST_DIR ./cmd/um
|
||||
- mkdir -p dist
|
||||
- tar -zc -C $DIST_DIR um | gzip -9 > "dist/um-darwin-arm64.tar.gz"
|
||||
environment:
|
||||
GOARCH: arm64
|
||||
GOOS: darwin
|
||||
GOPROXY: https://goproxy.io,direct
|
||||
image: golang:1.22
|
||||
name: go build darwin/arm64
|
||||
- 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}
|
||||
- commands:
|
||||
- git fetch --tags
|
||||
image: alpine/git
|
||||
name: fetch tags
|
||||
- commands:
|
||||
- go test -v ./...
|
||||
environment:
|
||||
GOPROXY: https://goproxy.io,direct
|
||||
image: golang:1.22
|
||||
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
|
||||
- mkdir -p dist
|
||||
- tar -zc -C $DIST_DIR um | gzip -9 > "dist/um-linux-amd64.tar.gz"
|
||||
environment:
|
||||
GOARCH: amd64
|
||||
GOOS: linux
|
||||
GOPROXY: https://goproxy.io,direct
|
||||
image: golang:1.22
|
||||
name: go build linux/amd64
|
||||
- commands:
|
||||
- DIST_DIR=$(mktemp -d)
|
||||
- go build -v -trimpath -ldflags="-w -s -X main.AppVersion=$(git describe --tags
|
||||
--always)" -o $DIST_DIR ./cmd/um
|
||||
- mkdir -p dist
|
||||
- tar -zc -C $DIST_DIR um | gzip -9 > "dist/um-linux-arm64.tar.gz"
|
||||
environment:
|
||||
GOARCH: arm64
|
||||
GOOS: linux
|
||||
GOPROXY: https://goproxy.io,direct
|
||||
image: golang:1.22
|
||||
name: go build linux/arm64
|
||||
- commands:
|
||||
- DIST_DIR=$(mktemp -d)
|
||||
- go build -v -trimpath -ldflags="-w -s -X main.AppVersion=$(git describe --tags
|
||||
--always)" -o $DIST_DIR ./cmd/um
|
||||
- mkdir -p dist
|
||||
- tar -zc -C $DIST_DIR um | gzip -9 > "dist/um-linux-386.tar.gz"
|
||||
environment:
|
||||
GOARCH: "386"
|
||||
GOOS: linux
|
||||
GOPROXY: https://goproxy.io,direct
|
||||
image: golang:1.22
|
||||
name: go build linux/386
|
||||
- commands:
|
||||
- DIST_DIR=$(mktemp -d)
|
||||
- go build -v -trimpath -ldflags="-w -s -X main.AppVersion=$(git describe --tags
|
||||
--always)" -o $DIST_DIR ./cmd/um
|
||||
- mkdir -p dist
|
||||
- command -v zip >/dev/null || (apt update && apt install -y zip)
|
||||
- zip -9 -j -r "dist/um-windows-amd64.zip" $DIST_DIR
|
||||
environment:
|
||||
GOARCH: amd64
|
||||
GOOS: windows
|
||||
GOPROXY: https://goproxy.io,direct
|
||||
image: golang:1.22
|
||||
name: go build windows/amd64
|
||||
- commands:
|
||||
- DIST_DIR=$(mktemp -d)
|
||||
- go build -v -trimpath -ldflags="-w -s -X main.AppVersion=$(git describe --tags
|
||||
--always)" -o $DIST_DIR ./cmd/um
|
||||
- mkdir -p dist
|
||||
- command -v zip >/dev/null || (apt update && apt install -y zip)
|
||||
- zip -9 -j -r "dist/um-windows-386.zip" $DIST_DIR
|
||||
environment:
|
||||
GOARCH: "386"
|
||||
GOOS: windows
|
||||
GOPROXY: https://goproxy.io,direct
|
||||
image: golang:1.22
|
||||
name: go build windows/386
|
||||
- commands:
|
||||
- DIST_DIR=$(mktemp -d)
|
||||
- go build -v -trimpath -ldflags="-w -s -X main.AppVersion=$(git describe --tags
|
||||
--always)" -o $DIST_DIR ./cmd/um
|
||||
- mkdir -p dist
|
||||
- tar -zc -C $DIST_DIR um | gzip -9 > "dist/um-darwin-amd64.tar.gz"
|
||||
environment:
|
||||
GOARCH: amd64
|
||||
GOOS: darwin
|
||||
GOPROXY: https://goproxy.io,direct
|
||||
image: golang:1.22
|
||||
name: go build darwin/amd64
|
||||
- commands:
|
||||
- DIST_DIR=$(mktemp -d)
|
||||
- go build -v -trimpath -ldflags="-w -s -X main.AppVersion=$(git describe --tags
|
||||
--always)" -o $DIST_DIR ./cmd/um
|
||||
- mkdir -p dist
|
||||
- tar -zc -C $DIST_DIR um | gzip -9 > "dist/um-darwin-arm64.tar.gz"
|
||||
environment:
|
||||
GOARCH: arm64
|
||||
GOOS: darwin
|
||||
GOPROXY: https://goproxy.io,direct
|
||||
image: golang:1.22
|
||||
name: go build darwin/arm64
|
||||
- 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
|
||||
- tag
|
||||
type: docker
|
||||
|
14
README.md
14
README.md
@ -28,16 +28,10 @@ Original: Web Edition https://git.unlock-music.dev/um/web
|
||||
|
||||
## Update CI pipeline
|
||||
|
||||
Ensure `jsonnet` and `yq` is installed.
|
||||
|
||||
```sh
|
||||
# Debian / Ubuntu etc:
|
||||
sudo apt install jsonnet yq
|
||||
```
|
||||
|
||||
1. Edit `.drone.jsonnet`
|
||||
2. Update drone CI pipeline:
|
||||
1. Install [Drone CI binary](https://docs.drone.io/cli/install/)
|
||||
2. Edit `.drone.jsonnet`
|
||||
3. Update drone CI pipeline:
|
||||
|
||||
```sh
|
||||
jsonnet -y .drone.jsonnet | yq -y > .drone.yml
|
||||
drone jsonnet --format --stream
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user