Compare commits

..

No commits in common. "ce9379d1660dadf648b1e7751934d60f44bedd82" and "f819726f3ec21865198143b832df1cc0d289b567" have entirely different histories.

3 changed files with 232 additions and 251 deletions

View File

@ -17,28 +17,21 @@ local CreateRelease() = {
local StepGoBuild(GOOS, GOARCH) = { local StepGoBuild(GOOS, GOARCH) = {
local archiveExt = if GOOS == 'windows' then 'zip' else 'tar.gz', local filepath = 'dist/um-%s-%s.tar.gz' % [GOOS, GOARCH],
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 [
'zip -9 -j -r "%s" $DIST_DIR' % filepath,
] else [
'tar -zc -C $DIST_DIR um | gzip -9 > "%s"' % filepath,
],
name: 'go build %s/%s' % [GOOS, GOARCH], name: 'go build %s/%s' % [GOOS, GOARCH],
image: 'golang:1.22', image: 'golang:1.22',
environment: { environment: {
GOOS: GOOS, GOOS: GOOS,
GOARCH: GOARCH, GOARCH: GOARCH,
GOPROXY: 'https://goproxy.io,direct', GOPROXY: "https://goproxy.io,direct",
}, },
commands: [ commands: [
'DIST_DIR=$(mktemp -d)', 'DIST_DIR=$(mktemp -d)',
'go build -v -trimpath -ldflags="-w -s -X main.AppVersion=$(git describe --tags --always)" -o $DIST_DIR ./cmd/um', 'go build -v -trimpath -ldflags="-w -s -X main.AppVersion=$(git describe --tags --always)" -o $DIST_DIR ./cmd/um',
'mkdir -p dist', 'mkdir -p dist',
] + archive, 'tar cz -f %s -C $DIST_DIR .' % filepath,
],
}; };
local StepUploadArtifact(GOOS, GOARCH) = { local StepUploadArtifact(GOOS, GOARCH) = {
@ -78,7 +71,7 @@ local PipelineBuild(GOOS, GOARCH, RUN_TEST) = {
name: 'go test', name: 'go test',
image: 'golang:1.22', image: 'golang:1.22',
environment: { environment: {
GOPROXY: 'https://goproxy.io,direct', GOPROXY: "https://goproxy.io,direct",
}, },
commands: ['go test -v ./...'], commands: ['go test -v ./...'],
}] else [] }] else []
@ -107,7 +100,7 @@ local PipelineRelease() = {
name: 'go test', name: 'go test',
image: 'golang:1.22', image: 'golang:1.22',
environment: { environment: {
GOPROXY: 'https://goproxy.io,direct', GOPROXY: "https://goproxy.io,direct",
}, },
commands: ['go test -v ./...'], commands: ['go test -v ./...'],
}, },

View File

@ -1,222 +1,226 @@
- kind: pipeline ---
name: build linux/amd64 kind: pipeline
steps: name: build linux/amd64
- commands: steps:
- git fetch --tags - commands:
image: alpine/git - git fetch --tags
name: fetch tags image: alpine/git
- commands: name: fetch tags
- go test -v ./... - commands:
environment: - go test -v ./...
GOPROXY: https://goproxy.io,direct environment:
image: golang:1.22 GOPROXY: https://goproxy.io,direct
name: go test image: golang:1.22
- commands: name: go test
- DIST_DIR=$(mktemp -d) - commands:
- go build -v -trimpath -ldflags="-w -s -X main.AppVersion=$(git describe - DIST_DIR=$(mktemp -d)
--tags --always)" -o $DIST_DIR ./cmd/um - go build -v -trimpath -ldflags="-w -s -X main.AppVersion=$(git describe --tags
- mkdir -p dist --always)" -o $DIST_DIR ./cmd/um
- tar -zc -C $DIST_DIR um | gzip -9 > "dist/um-linux-amd64.tar.gz" - mkdir -p dist
environment: - tar cz -f dist/um-linux-amd64.tar.gz -C $DIST_DIR .
GOARCH: amd64 environment:
GOOS: linux GOARCH: amd64
GOPROXY: https://goproxy.io,direct GOOS: linux
image: golang:1.22 GOPROXY: https://goproxy.io,direct
name: go build linux/amd64 image: golang:1.22
- commands: name: go build linux/amd64
- curl --fail --include --user "um-release-bot:$GITEA_API_KEY" --upload-file - commands:
"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" - curl --fail --include --user "um-release-bot:$GITEA_API_KEY" --upload-file "dist/um-linux-amd64.tar.gz"
- sha256sum 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"
- echo $DRONE_GITEA_SERVER/${DRONE_REPO_NAMESPACE}/-/packages/generic/${DRONE_REPO_NAME}-build/${DRONE_BUILD_NUMBER} - sha256sum dist/um-linux-amd64.tar.gz
environment: - echo $DRONE_GITEA_SERVER/${DRONE_REPO_NAMESPACE}/-/packages/generic/${DRONE_REPO_NAME}-build/${DRONE_BUILD_NUMBER}
DRONE_GITEA_SERVER: https://git.unlock-music.dev environment:
GITEA_API_KEY: DRONE_GITEA_SERVER: https://git.unlock-music.dev
from_secret: GITEA_API_KEY GITEA_API_KEY:
image: golang:1.22 from_secret: GITEA_API_KEY
name: upload artifact image: golang:1.22
trigger: name: upload artifact
event: trigger:
- push event:
- pull_request - push
type: docker - pull_request
- kind: pipeline type: docker
name: build windows/amd64 ---
steps: kind: pipeline
- commands: name: build windows/amd64
- git fetch --tags steps:
image: alpine/git - commands:
name: fetch tags - git fetch --tags
- commands: image: alpine/git
- DIST_DIR=$(mktemp -d) name: fetch tags
- go build -v -trimpath -ldflags="-w -s -X main.AppVersion=$(git describe - commands:
--tags --always)" -o $DIST_DIR ./cmd/um - DIST_DIR=$(mktemp -d)
- mkdir -p dist - go build -v -trimpath -ldflags="-w -s -X main.AppVersion=$(git describe --tags
- zip -9 -j -r "dist/um-windows-amd64.zip" $DIST_DIR --always)" -o $DIST_DIR ./cmd/um
environment: - mkdir -p dist
GOARCH: amd64 - tar cz -f dist/um-windows-amd64.tar.gz -C $DIST_DIR .
GOOS: windows environment:
GOPROXY: https://goproxy.io,direct GOARCH: amd64
image: golang:1.22 GOOS: windows
name: go build windows/amd64 GOPROXY: https://goproxy.io,direct
- commands: image: golang:1.22
- curl --fail --include --user "um-release-bot:$GITEA_API_KEY" --upload-file name: go build windows/amd64
"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" - commands:
- sha256sum dist/um-windows-amd64.tar.gz - curl --fail --include --user "um-release-bot:$GITEA_API_KEY" --upload-file "dist/um-windows-amd64.tar.gz"
- echo $DRONE_GITEA_SERVER/${DRONE_REPO_NAMESPACE}/-/packages/generic/${DRONE_REPO_NAME}-build/${DRONE_BUILD_NUMBER} "$DRONE_GITEA_SERVER/api/packages/${DRONE_REPO_NAMESPACE}/generic/${DRONE_REPO_NAME}-build/${DRONE_BUILD_NUMBER}/um-windows-amd64.tar.gz"
environment: - sha256sum dist/um-windows-amd64.tar.gz
DRONE_GITEA_SERVER: https://git.unlock-music.dev - echo $DRONE_GITEA_SERVER/${DRONE_REPO_NAMESPACE}/-/packages/generic/${DRONE_REPO_NAME}-build/${DRONE_BUILD_NUMBER}
GITEA_API_KEY: environment:
from_secret: GITEA_API_KEY DRONE_GITEA_SERVER: https://git.unlock-music.dev
image: golang:1.22 GITEA_API_KEY:
name: upload artifact from_secret: GITEA_API_KEY
trigger: image: golang:1.22
event: name: upload artifact
- push trigger:
- pull_request event:
type: docker - push
- kind: pipeline - pull_request
name: build darwin/amd64 type: docker
steps: ---
- commands: kind: pipeline
- git fetch --tags name: build darwin/amd64
image: alpine/git steps:
name: fetch tags - commands:
- commands: - git fetch --tags
- DIST_DIR=$(mktemp -d) image: alpine/git
- go build -v -trimpath -ldflags="-w -s -X main.AppVersion=$(git describe name: fetch tags
--tags --always)" -o $DIST_DIR ./cmd/um - commands:
- mkdir -p dist - DIST_DIR=$(mktemp -d)
- tar -zc -C $DIST_DIR um | gzip -9 > "dist/um-darwin-amd64.tar.gz" - go build -v -trimpath -ldflags="-w -s -X main.AppVersion=$(git describe --tags
environment: --always)" -o $DIST_DIR ./cmd/um
GOARCH: amd64 - mkdir -p dist
GOOS: darwin - tar cz -f dist/um-darwin-amd64.tar.gz -C $DIST_DIR .
GOPROXY: https://goproxy.io,direct environment:
image: golang:1.22 GOARCH: amd64
name: go build darwin/amd64 GOOS: darwin
- commands: GOPROXY: https://goproxy.io,direct
- curl --fail --include --user "um-release-bot:$GITEA_API_KEY" --upload-file image: golang:1.22
"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" name: go build darwin/amd64
- sha256sum dist/um-darwin-amd64.tar.gz - commands:
- echo $DRONE_GITEA_SERVER/${DRONE_REPO_NAMESPACE}/-/packages/generic/${DRONE_REPO_NAME}-build/${DRONE_BUILD_NUMBER} - curl --fail --include --user "um-release-bot:$GITEA_API_KEY" --upload-file "dist/um-darwin-amd64.tar.gz"
environment: "$DRONE_GITEA_SERVER/api/packages/${DRONE_REPO_NAMESPACE}/generic/${DRONE_REPO_NAME}-build/${DRONE_BUILD_NUMBER}/um-darwin-amd64.tar.gz"
DRONE_GITEA_SERVER: https://git.unlock-music.dev - sha256sum dist/um-darwin-amd64.tar.gz
GITEA_API_KEY: - echo $DRONE_GITEA_SERVER/${DRONE_REPO_NAMESPACE}/-/packages/generic/${DRONE_REPO_NAME}-build/${DRONE_BUILD_NUMBER}
from_secret: GITEA_API_KEY environment:
image: golang:1.22 DRONE_GITEA_SERVER: https://git.unlock-music.dev
name: upload artifact GITEA_API_KEY:
trigger: from_secret: GITEA_API_KEY
event: image: golang:1.22
- push name: upload artifact
- pull_request trigger:
type: docker event:
- kind: pipeline - push
name: release - pull_request
steps: type: docker
- commands: ---
- git fetch --tags kind: pipeline
image: alpine/git name: release
name: fetch tags steps:
- commands: - commands:
- go test -v ./... - git fetch --tags
environment: image: alpine/git
GOPROXY: https://goproxy.io,direct name: fetch tags
image: golang:1.22 - commands:
name: go test - go test -v ./...
- commands: environment:
- DIST_DIR=$(mktemp -d) GOPROXY: https://goproxy.io,direct
- go build -v -trimpath -ldflags="-w -s -X main.AppVersion=$(git describe image: golang:1.22
--tags --always)" -o $DIST_DIR ./cmd/um name: go test
- mkdir -p dist - commands:
- tar -zc -C $DIST_DIR um | gzip -9 > "dist/um-linux-amd64.tar.gz" - DIST_DIR=$(mktemp -d)
environment: - go build -v -trimpath -ldflags="-w -s -X main.AppVersion=$(git describe --tags
GOARCH: amd64 --always)" -o $DIST_DIR ./cmd/um
GOOS: linux - mkdir -p dist
GOPROXY: https://goproxy.io,direct - tar cz -f dist/um-linux-amd64.tar.gz -C $DIST_DIR .
image: golang:1.22 environment:
name: go build linux/amd64 GOARCH: amd64
- commands: GOOS: linux
- DIST_DIR=$(mktemp -d) GOPROXY: https://goproxy.io,direct
- go build -v -trimpath -ldflags="-w -s -X main.AppVersion=$(git describe image: golang:1.22
--tags --always)" -o $DIST_DIR ./cmd/um name: go build linux/amd64
- mkdir -p dist - commands:
- tar -zc -C $DIST_DIR um | gzip -9 > "dist/um-linux-arm64.tar.gz" - DIST_DIR=$(mktemp -d)
environment: - go build -v -trimpath -ldflags="-w -s -X main.AppVersion=$(git describe --tags
GOARCH: arm64 --always)" -o $DIST_DIR ./cmd/um
GOOS: linux - mkdir -p dist
GOPROXY: https://goproxy.io,direct - tar cz -f dist/um-linux-arm64.tar.gz -C $DIST_DIR .
image: golang:1.22 environment:
name: go build linux/arm64 GOARCH: arm64
- commands: GOOS: linux
- DIST_DIR=$(mktemp -d) GOPROXY: https://goproxy.io,direct
- go build -v -trimpath -ldflags="-w -s -X main.AppVersion=$(git describe image: golang:1.22
--tags --always)" -o $DIST_DIR ./cmd/um name: go build linux/arm64
- mkdir -p dist - commands:
- tar -zc -C $DIST_DIR um | gzip -9 > "dist/um-linux-386.tar.gz" - DIST_DIR=$(mktemp -d)
environment: - go build -v -trimpath -ldflags="-w -s -X main.AppVersion=$(git describe --tags
GOARCH: '386' --always)" -o $DIST_DIR ./cmd/um
GOOS: linux - mkdir -p dist
GOPROXY: https://goproxy.io,direct - tar cz -f dist/um-linux-386.tar.gz -C $DIST_DIR .
image: golang:1.22 environment:
name: go build linux/386 GOARCH: "386"
- commands: GOOS: linux
- DIST_DIR=$(mktemp -d) GOPROXY: https://goproxy.io,direct
- go build -v -trimpath -ldflags="-w -s -X main.AppVersion=$(git describe image: golang:1.22
--tags --always)" -o $DIST_DIR ./cmd/um name: go build linux/386
- mkdir -p dist - commands:
- zip -9 -j -r "dist/um-windows-amd64.zip" $DIST_DIR - DIST_DIR=$(mktemp -d)
environment: - go build -v -trimpath -ldflags="-w -s -X main.AppVersion=$(git describe --tags
GOARCH: amd64 --always)" -o $DIST_DIR ./cmd/um
GOOS: windows - mkdir -p dist
GOPROXY: https://goproxy.io,direct - tar cz -f dist/um-windows-amd64.tar.gz -C $DIST_DIR .
image: golang:1.22 environment:
name: go build windows/amd64 GOARCH: amd64
- commands: GOOS: windows
- DIST_DIR=$(mktemp -d) GOPROXY: https://goproxy.io,direct
- go build -v -trimpath -ldflags="-w -s -X main.AppVersion=$(git describe image: golang:1.22
--tags --always)" -o $DIST_DIR ./cmd/um name: go build windows/amd64
- mkdir -p dist - commands:
- zip -9 -j -r "dist/um-windows-386.zip" $DIST_DIR - DIST_DIR=$(mktemp -d)
environment: - go build -v -trimpath -ldflags="-w -s -X main.AppVersion=$(git describe --tags
GOARCH: '386' --always)" -o $DIST_DIR ./cmd/um
GOOS: windows - mkdir -p dist
GOPROXY: https://goproxy.io,direct - tar cz -f dist/um-windows-386.tar.gz -C $DIST_DIR .
image: golang:1.22 environment:
name: go build windows/386 GOARCH: "386"
- commands: GOOS: windows
- DIST_DIR=$(mktemp -d) GOPROXY: https://goproxy.io,direct
- go build -v -trimpath -ldflags="-w -s -X main.AppVersion=$(git describe image: golang:1.22
--tags --always)" -o $DIST_DIR ./cmd/um name: go build windows/386
- mkdir -p dist - commands:
- tar -zc -C $DIST_DIR um | gzip -9 > "dist/um-darwin-amd64.tar.gz" - DIST_DIR=$(mktemp -d)
environment: - go build -v -trimpath -ldflags="-w -s -X main.AppVersion=$(git describe --tags
GOARCH: amd64 --always)" -o $DIST_DIR ./cmd/um
GOOS: darwin - mkdir -p dist
GOPROXY: https://goproxy.io,direct - tar cz -f dist/um-darwin-amd64.tar.gz -C $DIST_DIR .
image: golang:1.22 environment:
name: go build darwin/amd64 GOARCH: amd64
- commands: GOOS: darwin
- DIST_DIR=$(mktemp -d) GOPROXY: https://goproxy.io,direct
- go build -v -trimpath -ldflags="-w -s -X main.AppVersion=$(git describe image: golang:1.22
--tags --always)" -o $DIST_DIR ./cmd/um name: go build darwin/amd64
- mkdir -p dist - commands:
- tar -zc -C $DIST_DIR um | gzip -9 > "dist/um-darwin-arm64.tar.gz" - DIST_DIR=$(mktemp -d)
environment: - go build -v -trimpath -ldflags="-w -s -X main.AppVersion=$(git describe --tags
GOARCH: arm64 --always)" -o $DIST_DIR ./cmd/um
GOOS: darwin - mkdir -p dist
GOPROXY: https://goproxy.io,direct - tar cz -f dist/um-darwin-arm64.tar.gz -C $DIST_DIR .
image: golang:1.22 environment:
name: go build darwin/arm64 GOARCH: arm64
- image: plugins/gitea-release GOOS: darwin
name: create release GOPROXY: https://goproxy.io,direct
settings: image: golang:1.22
api_key: name: go build darwin/arm64
from_secret: GITEA_API_KEY - image: plugins/gitea-release
base_url: https://git.unlock-music.dev name: create release
checksum: sha256 settings:
draft: true api_key:
files: dist/* from_secret: GITEA_API_KEY
title: ${DRONE_TAG} base_url: https://git.unlock-music.dev
trigger: checksum: sha256
event: draft: true
- tag files: dist/*
type: docker title: ${DRONE_TAG}
trigger:
event:
- tag
type: docker

View File

@ -25,19 +25,3 @@ Original: Web Edition https://git.unlock-music.dev/um/web
- Drag the encrypted file to `um.exe` (Tested on Windows) - Drag the encrypted file to `um.exe` (Tested on Windows)
- Run: `./um [-o <output dir>] [-i] <input dir/file>` - Run: `./um [-o <output dir>] [-i] <input dir/file>`
- Use `./um -h` to show help menu - Use `./um -h` to show help menu
## 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:
```sh
jsonnet .drone.jsonnet | yq -y > .drone.yml
```