Compare commits

..

No commits in common. "101cb2ef98d62af5d537c08760b05ddba0ec7bb9" and "89b629304eee323570d0c0eeccc11c6edb66aafb" have entirely different histories.

4 changed files with 26 additions and 54 deletions

View File

@ -8,10 +8,7 @@ local CreateRelease() = {
settings: { settings: {
api_key: { from_secret: 'GITEA_API_KEY' }, api_key: { from_secret: 'GITEA_API_KEY' },
base_url: 'https://git.unlock-music.dev', base_url: 'https://git.unlock-music.dev',
files: [ files: 'dist/*',
'um-*.tar.gz',
'um-*.zip',
],
checksum: 'sha256', checksum: 'sha256',
draft: true, draft: true,
title: '${DRONE_TAG}', title: '${DRONE_TAG}',
@ -22,14 +19,14 @@ local CreateRelease() = {
local StepGoBuild(GOOS, GOARCH) = { local StepGoBuild(GOOS, GOARCH) = {
local windows = GOOS == 'windows', local windows = GOOS == 'windows',
local archiveExt = if windows then 'zip' else 'tar.gz', local archiveExt = if windows then 'zip' else 'tar.gz',
local filepath = 'dist/um-%s-%s-%s.%s' % [GOOS, GOARCH, '$(git describe --tags --always)', archiveExt], local filepath = 'dist/um-%s-%s.%s' % [GOOS, GOARCH, archiveExt],
local archive = if windows then [ local archive = if windows then [
// Ensure zip is installed // Ensure zip is installed
'command -v zip >/dev/null || (apt update && apt install -y zip)', '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 -c -C $DIST_DIR um | gzip -9 > "%s"' % filepath, 'tar -zc -C $DIST_DIR um | gzip -9 > "%s"' % filepath,
], ],
name: 'go build %s/%s' % [GOOS, GOARCH], name: 'go build %s/%s' % [GOOS, GOARCH],
@ -49,7 +46,7 @@ local StepGoBuild(GOOS, GOARCH) = {
local StepUploadArtifact(GOOS, GOARCH) = { local StepUploadArtifact(GOOS, GOARCH) = {
local windows = GOOS == 'windows', local windows = GOOS == 'windows',
local archiveExt = if windows then 'zip' else 'tar.gz', local archiveExt = if windows then 'zip' else 'tar.gz',
local filename = 'um-%s-%s-%s.%s' % [GOOS, GOARCH, '$(git describe --tags --always)', archiveExt], local filename = 'um-%s-%s.%s' % [GOOS, GOARCH, archiveExt],
local filepath = 'dist/%s' % filename, local filepath = 'dist/%s' % filename,
local pkgname = '${DRONE_REPO_NAME}-build', local pkgname = '${DRONE_REPO_NAME}-build',
@ -126,13 +123,6 @@ local PipelineRelease() = {
StepGoBuild('windows', '386'), StepGoBuild('windows', '386'),
StepGoBuild('darwin', 'amd64'), StepGoBuild('darwin', 'amd64'),
StepGoBuild('darwin', 'arm64'), StepGoBuild('darwin', 'arm64'),
{
name: 'prepare root',
image: 'golang:1.22',
commands: [
'mv dist/*.{tar.gz,zip} ./',
],
},
CreateRelease(), CreateRelease(),
], ],
trigger: { trigger: {

View File

@ -17,8 +17,7 @@ steps:
- 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 -c -C $DIST_DIR um | gzip -9 > "dist/um-linux-amd64-$(git describe --tags - tar -zc -C $DIST_DIR um | gzip -9 > "dist/um-linux-amd64.tar.gz"
--always).tar.gz"
environment: environment:
GOARCH: amd64 GOARCH: amd64
GOOS: linux GOOS: linux
@ -26,10 +25,9 @@ steps:
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-$(git - curl --fail --include --user "um-release-bot:$GITEA_API_KEY" --upload-file "dist/um-linux-amd64.tar.gz"
describe --tags --always).tar.gz" "$DRONE_GITEA_SERVER/api/packages/${DRONE_REPO_NAMESPACE}/generic/${DRONE_REPO_NAME}-build/${DRONE_BUILD_NUMBER}/um-linux-amd64-$(git "$DRONE_GITEA_SERVER/api/packages/${DRONE_REPO_NAMESPACE}/generic/${DRONE_REPO_NAME}-build/${DRONE_BUILD_NUMBER}/um-linux-amd64.tar.gz"
describe --tags --always).tar.gz" - sha256sum dist/um-linux-amd64.tar.gz
- sha256sum dist/um-linux-amd64-$(git describe --tags --always).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:
DRONE_GITEA_SERVER: https://git.unlock-music.dev DRONE_GITEA_SERVER: https://git.unlock-music.dev
@ -56,7 +54,7 @@ steps:
--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) - command -v zip >/dev/null || (apt update && apt install -y zip)
- zip -9 -j -r "dist/um-windows-amd64-$(git describe --tags --always).zip" $DIST_DIR - zip -9 -j -r "dist/um-windows-amd64.zip" $DIST_DIR
environment: environment:
GOARCH: amd64 GOARCH: amd64
GOOS: windows GOOS: windows
@ -64,10 +62,9 @@ steps:
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-$(git - curl --fail --include --user "um-release-bot:$GITEA_API_KEY" --upload-file "dist/um-windows-amd64.zip"
describe --tags --always).zip" "$DRONE_GITEA_SERVER/api/packages/${DRONE_REPO_NAMESPACE}/generic/${DRONE_REPO_NAME}-build/${DRONE_BUILD_NUMBER}/um-windows-amd64-$(git "$DRONE_GITEA_SERVER/api/packages/${DRONE_REPO_NAMESPACE}/generic/${DRONE_REPO_NAME}-build/${DRONE_BUILD_NUMBER}/um-windows-amd64.zip"
describe --tags --always).zip" - sha256sum dist/um-windows-amd64.zip
- sha256sum dist/um-windows-amd64-$(git describe --tags --always).zip
- 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:
DRONE_GITEA_SERVER: https://git.unlock-music.dev DRONE_GITEA_SERVER: https://git.unlock-music.dev
@ -93,8 +90,7 @@ steps:
- 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 -c -C $DIST_DIR um | gzip -9 > "dist/um-darwin-amd64-$(git describe --tags - tar -zc -C $DIST_DIR um | gzip -9 > "dist/um-darwin-amd64.tar.gz"
--always).tar.gz"
environment: environment:
GOARCH: amd64 GOARCH: amd64
GOOS: darwin GOOS: darwin
@ -102,10 +98,9 @@ steps:
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-$(git - curl --fail --include --user "um-release-bot:$GITEA_API_KEY" --upload-file "dist/um-darwin-amd64.tar.gz"
describe --tags --always).tar.gz" "$DRONE_GITEA_SERVER/api/packages/${DRONE_REPO_NAMESPACE}/generic/${DRONE_REPO_NAME}-build/${DRONE_BUILD_NUMBER}/um-darwin-amd64-$(git "$DRONE_GITEA_SERVER/api/packages/${DRONE_REPO_NAMESPACE}/generic/${DRONE_REPO_NAME}-build/${DRONE_BUILD_NUMBER}/um-darwin-amd64.tar.gz"
describe --tags --always).tar.gz" - sha256sum dist/um-darwin-amd64.tar.gz
- sha256sum dist/um-darwin-amd64-$(git describe --tags --always).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:
DRONE_GITEA_SERVER: https://git.unlock-music.dev DRONE_GITEA_SERVER: https://git.unlock-music.dev
@ -137,8 +132,7 @@ steps:
- 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 -c -C $DIST_DIR um | gzip -9 > "dist/um-linux-amd64-$(git describe --tags - tar -zc -C $DIST_DIR um | gzip -9 > "dist/um-linux-amd64.tar.gz"
--always).tar.gz"
environment: environment:
GOARCH: amd64 GOARCH: amd64
GOOS: linux GOOS: linux
@ -150,8 +144,7 @@ steps:
- 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 -c -C $DIST_DIR um | gzip -9 > "dist/um-linux-arm64-$(git describe --tags - tar -zc -C $DIST_DIR um | gzip -9 > "dist/um-linux-arm64.tar.gz"
--always).tar.gz"
environment: environment:
GOARCH: arm64 GOARCH: arm64
GOOS: linux GOOS: linux
@ -163,7 +156,7 @@ steps:
- 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 -c -C $DIST_DIR um | gzip -9 > "dist/um-linux-386-$(git describe --tags --always).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
@ -176,7 +169,7 @@ steps:
--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) - command -v zip >/dev/null || (apt update && apt install -y zip)
- zip -9 -j -r "dist/um-windows-amd64-$(git describe --tags --always).zip" $DIST_DIR - zip -9 -j -r "dist/um-windows-amd64.zip" $DIST_DIR
environment: environment:
GOARCH: amd64 GOARCH: amd64
GOOS: windows GOOS: windows
@ -189,7 +182,7 @@ steps:
--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) - command -v zip >/dev/null || (apt update && apt install -y zip)
- zip -9 -j -r "dist/um-windows-arm64-$(git describe --tags --always).zip" $DIST_DIR - zip -9 -j -r "dist/um-windows-arm64.zip" $DIST_DIR
environment: environment:
GOARCH: arm64 GOARCH: arm64
GOOS: windows GOOS: windows
@ -202,7 +195,7 @@ steps:
--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) - command -v zip >/dev/null || (apt update && apt install -y zip)
- zip -9 -j -r "dist/um-windows-386-$(git describe --tags --always).zip" $DIST_DIR - zip -9 -j -r "dist/um-windows-386.zip" $DIST_DIR
environment: environment:
GOARCH: "386" GOARCH: "386"
GOOS: windows GOOS: windows
@ -214,8 +207,7 @@ steps:
- 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 -c -C $DIST_DIR um | gzip -9 > "dist/um-darwin-amd64-$(git describe --tags - tar -zc -C $DIST_DIR um | gzip -9 > "dist/um-darwin-amd64.tar.gz"
--always).tar.gz"
environment: environment:
GOARCH: amd64 GOARCH: amd64
GOOS: darwin GOOS: darwin
@ -227,18 +219,13 @@ steps:
- 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 -c -C $DIST_DIR um | gzip -9 > "dist/um-darwin-arm64-$(git describe --tags - tar -zc -C $DIST_DIR um | gzip -9 > "dist/um-darwin-arm64.tar.gz"
--always).tar.gz"
environment: environment:
GOARCH: arm64 GOARCH: arm64
GOOS: darwin GOOS: darwin
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
- commands:
- mv dist/*.{tar.gz,zip} ./
image: golang:1.22
name: prepare root
- image: plugins/gitea-release - image: plugins/gitea-release
name: create release name: create release
settings: settings:
@ -247,9 +234,7 @@ steps:
base_url: https://git.unlock-music.dev base_url: https://git.unlock-music.dev
checksum: sha256 checksum: sha256
draft: true draft: true
files: files: dist/*
- um-*.tar.gz
- um-*.zip
title: ${DRONE_TAG} title: ${DRONE_TAG}
trigger: trigger:
event: event:

3
.gitignore vendored
View File

@ -2,6 +2,3 @@
/dist /dist
*.exe *.exe
/um-*.tar.gz
/um-*.zip

View File

@ -34,7 +34,7 @@ import (
"unlock-music.dev/cli/internal/utils" "unlock-music.dev/cli/internal/utils"
) )
var AppVersion = "v0.2.7" var AppVersion = "v0.2.6"
var logger, _ = logging.NewZapLogger() // TODO: inject logger to application, instead of using global logger var logger, _ = logging.NewZapLogger() // TODO: inject logger to application, instead of using global logger