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