From 26b580a4b85bd53f95ca47edb8acf026bf88072a Mon Sep 17 00:00:00 2001 From: Unlock Music Dev Date: Sun, 27 Nov 2022 02:42:13 +0800 Subject: [PATCH 1/4] ci: init with go build --- .drone.jsonnet | 87 ++++++++++++++++++++++++++++++++++++++++ .drone.yml | 106 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 193 insertions(+) create mode 100644 .drone.jsonnet create mode 100644 .drone.yml diff --git a/.drone.jsonnet b/.drone.jsonnet new file mode 100644 index 0000000..ab6711e --- /dev/null +++ b/.drone.jsonnet @@ -0,0 +1,87 @@ +// generate .drone.yaml, run: +// drone jsonnet --format --stream + + +// local CreateRelease() = { +// name: 'create release', +// image: 'plugins/gitea-release', +// settings: { +// api_key: { from_secret: 'GITEA_API_KEY' }, +// base_url: 'https://git.unlock-music.dev', +// files: 'dist/*', +// checksum: 'sha256', +// draft: true, +// title: '${DRONE_TAG}', +// }, +// }; + + +local StepGoBuild(GOOS, GOARCH) = { + local filename = 'um-%s-%s.tar.gz' % [GOOS, GOARCH], + + name: 'go build', + image: 'golang:1.19', + environment: { + GOOS: GOOS, + GOARCH: GOARCH, + }, + 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 %s -C $DIST_DIR .' % filename, + ], +}; + +local StepUploadArtifact(GOOS, GOARCH) = { + local filename = 'um-%s-%s.tar.gz' % [GOOS, GOARCH], + local pkgname = '${DRONE_REPO_NAME}-build', + + name: 'upload artifact', + image: 'golang:1.19', // reuse golang:1.19 for curl + environment: { + DRONE_GITEA_SERVER: 'https://git.unlock-music.dev', + GITEA_API_KEY: { from_secret: 'GITEA_API_KEY' }, + }, + commands: [ + 'curl --fail --include --user "um-release-bot:$GITEA_API_KEY" ' + + '--upload-file "%s" ' % filename + + '"$DRONE_GITEA_SERVER/api/packages/${DRONE_REPO_NAMESPACE}/generic/%s/${DRONE_BUILD_NUMBER}/%s"' % [pkgname, filename], + 'sha256sum %s' % filename, + 'echo $DRONE_GITEA_SERVER/${DRONE_REPO_NAMESPACE}/-/packages/generic/%s/${DRONE_BUILD_NUMBER}' % pkgname, + ], +}; + + +local PipelineBuild(GOOS, GOARCH, RUN_TEST) = { + name: 'build %s/%s' % [GOOS, GOARCH], + kind: 'pipeline', + type: 'docker', + steps: [ + { + name: 'fetch tags', + image: 'alpine/git', + commands: ['git fetch --tags'], + }, + ] + + ( + if RUN_TEST then [{ + name: 'go test', + image: 'golang:1.19', + commands: ['go test -v ./...'], + }] else [] + ) + + + [ + StepGoBuild(GOOS, GOARCH), + StepUploadArtifact(GOOS, GOARCH), + ], + trigger: { + event: ['push', 'pull_request'], + }, +}; + +[ + PipelineBuild('linux', 'amd64', true), + PipelineBuild('windows', 'amd64', false), + PipelineBuild('darwin', 'amd64', false), +] diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..dd6f9cf --- /dev/null +++ b/.drone.yml @@ -0,0 +1,106 @@ +--- +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 + - tar cz -f um-linux-amd64.tar.gz -C $DIST_DIR . + environment: + GOARCH: amd64 + GOOS: linux + image: golang:1.19 + name: go build +- commands: + - curl --fail --include --user "um-release-bot:$GITEA_API_KEY" --upload-file "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 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.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 + - tar cz -f um-windows-amd64.tar.gz -C $DIST_DIR . + environment: + GOARCH: amd64 + GOOS: windows + image: golang:1.19 + name: go build +- commands: + - curl --fail --include --user "um-release-bot:$GITEA_API_KEY" --upload-file "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 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.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 + - tar cz -f um-darwin-amd64.tar.gz -C $DIST_DIR . + environment: + GOARCH: amd64 + GOOS: darwin + image: golang:1.19 + name: go build +- commands: + - curl --fail --include --user "um-release-bot:$GITEA_API_KEY" --upload-file "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 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.19 + name: upload artifact +trigger: + event: + - push + - pull_request +type: docker From 04320bd45adcc37432fd46089ee276869df166f7 Mon Sep 17 00:00:00 2001 From: Unlock Music Dev Date: Sun, 27 Nov 2022 07:45:44 +0800 Subject: [PATCH 2/4] ci: add release pipeline --- .drone.jsonnet | 63 ++++++++++++++++++++------- .drone.yml | 114 +++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 152 insertions(+), 25 deletions(-) diff --git a/.drone.jsonnet b/.drone.jsonnet index ab6711e..9d71e93 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -2,22 +2,22 @@ // drone jsonnet --format --stream -// local CreateRelease() = { -// name: 'create release', -// image: 'plugins/gitea-release', -// settings: { -// api_key: { from_secret: 'GITEA_API_KEY' }, -// base_url: 'https://git.unlock-music.dev', -// files: 'dist/*', -// checksum: 'sha256', -// draft: true, -// title: '${DRONE_TAG}', -// }, -// }; +local CreateRelease() = { + name: 'create release', + image: 'plugins/gitea-release', + settings: { + api_key: { from_secret: 'GITEA_API_KEY' }, + base_url: 'https://git.unlock-music.dev', + files: 'dist/*', + checksum: 'sha256', + draft: true, + title: '${DRONE_TAG}', + }, +}; local StepGoBuild(GOOS, GOARCH) = { - local filename = 'um-%s-%s.tar.gz' % [GOOS, GOARCH], + local filepath = 'dist/um-%s-%s.tar.gz' % [GOOS, GOARCH], name: 'go build', image: 'golang:1.19', @@ -28,12 +28,13 @@ local StepGoBuild(GOOS, GOARCH) = { 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 %s -C $DIST_DIR .' % filename, + 'tar cz -f %s -C $DIST_DIR .' % filepath, ], }; local StepUploadArtifact(GOOS, GOARCH) = { local filename = 'um-%s-%s.tar.gz' % [GOOS, GOARCH], + local filepath = 'dist/%s' % filename, local pkgname = '${DRONE_REPO_NAME}-build', name: 'upload artifact', @@ -44,9 +45,9 @@ local StepUploadArtifact(GOOS, GOARCH) = { }, commands: [ 'curl --fail --include --user "um-release-bot:$GITEA_API_KEY" ' + - '--upload-file "%s" ' % filename + + '--upload-file "%s" ' % filepath + '"$DRONE_GITEA_SERVER/api/packages/${DRONE_REPO_NAMESPACE}/generic/%s/${DRONE_BUILD_NUMBER}/%s"' % [pkgname, filename], - 'sha256sum %s' % filename, + 'sha256sum %s' % filepath, 'echo $DRONE_GITEA_SERVER/${DRONE_REPO_NAMESPACE}/-/packages/generic/%s/${DRONE_BUILD_NUMBER}' % pkgname, ], }; @@ -80,8 +81,38 @@ local PipelineBuild(GOOS, GOARCH, RUN_TEST) = { }, }; +local PipelineRelease() = { + name: 'release', + kind: 'pipeline', + type: 'docker', + steps: [ + { + name: 'fetch tags', + image: 'alpine/git', + commands: ['git fetch --tags'], + }, + { + name: 'go test', + image: 'golang:1.19', + commands: ['go test -v ./...'], + }, + StepGoBuild('linux', 'amd64'), + StepGoBuild('linux', 'arm64'), + StepGoBuild('linux', '386'), + StepGoBuild('windows', 'amd64'), + StepGoBuild('windows', '386'), + StepGoBuild('darwin', 'amd64'), + StepGoBuild('darwin', 'arm64'), + CreateRelease(), + ], + trigger: { + event: ['tag'], + }, +}; + [ PipelineBuild('linux', 'amd64', true), PipelineBuild('windows', 'amd64', false), PipelineBuild('darwin', 'amd64', false), + PipelineRelease(), ] diff --git a/.drone.yml b/.drone.yml index dd6f9cf..da2d84e 100644 --- a/.drone.yml +++ b/.drone.yml @@ -14,16 +14,16 @@ steps: - 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 um-linux-amd64.tar.gz -C $DIST_DIR . + - 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: - - curl --fail --include --user "um-release-bot:$GITEA_API_KEY" --upload-file "um-linux-amd64.tar.gz" + - 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 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 @@ -48,16 +48,16 @@ steps: - 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 um-windows-amd64.tar.gz -C $DIST_DIR . + - 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: - - curl --fail --include --user "um-release-bot:$GITEA_API_KEY" --upload-file "um-windows-amd64.tar.gz" + - 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 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 @@ -82,16 +82,16 @@ steps: - 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 um-darwin-amd64.tar.gz -C $DIST_DIR . + - 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: - - curl --fail --include --user "um-release-bot:$GITEA_API_KEY" --upload-file "um-darwin-amd64.tar.gz" + - 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 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 @@ -104,3 +104,99 @@ trigger: - push - pull_request type: docker +--- +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 From e7d360362e34e02f4e2a60c62dcb34105e52989f Mon Sep 17 00:00:00 2001 From: Unlock Music Dev Date: Sun, 27 Nov 2022 07:47:42 +0800 Subject: [PATCH 3/4] ci: fix duplicated name --- .drone.jsonnet | 2 +- .drone.yml | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.drone.jsonnet b/.drone.jsonnet index 9d71e93..6b33dca 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -19,7 +19,7 @@ local CreateRelease() = { local StepGoBuild(GOOS, GOARCH) = { local filepath = 'dist/um-%s-%s.tar.gz' % [GOOS, GOARCH], - name: 'go build', + name: 'go build %s/%s' % [GOOS, GOARCH], image: 'golang:1.19', environment: { GOOS: GOOS, diff --git a/.drone.yml b/.drone.yml index da2d84e..eb84a99 100644 --- a/.drone.yml +++ b/.drone.yml @@ -19,7 +19,7 @@ steps: GOARCH: amd64 GOOS: linux image: golang:1.19 - name: go build + 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" @@ -53,7 +53,7 @@ steps: GOARCH: amd64 GOOS: windows image: golang:1.19 - name: go build + 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" @@ -87,7 +87,7 @@ steps: GOARCH: amd64 GOOS: darwin image: golang:1.19 - name: go build + 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" @@ -125,7 +125,7 @@ steps: GOARCH: amd64 GOOS: linux image: golang:1.19 - name: go build + name: go build linux/amd64 - commands: - DIST_DIR=$(mktemp -d) - go build -v -trimpath -ldflags="-w -s -X main.AppVersion=$(git describe --tags @@ -135,7 +135,7 @@ steps: GOARCH: arm64 GOOS: linux image: golang:1.19 - name: go build + name: go build linux/arm64 - commands: - DIST_DIR=$(mktemp -d) - go build -v -trimpath -ldflags="-w -s -X main.AppVersion=$(git describe --tags @@ -145,7 +145,7 @@ steps: GOARCH: "386" GOOS: linux image: golang:1.19 - name: go build + name: go build linux/386 - commands: - DIST_DIR=$(mktemp -d) - go build -v -trimpath -ldflags="-w -s -X main.AppVersion=$(git describe --tags @@ -155,7 +155,7 @@ steps: GOARCH: amd64 GOOS: windows image: golang:1.19 - name: go build + name: go build windows/amd64 - commands: - DIST_DIR=$(mktemp -d) - go build -v -trimpath -ldflags="-w -s -X main.AppVersion=$(git describe --tags @@ -165,7 +165,7 @@ steps: GOARCH: "386" GOOS: windows image: golang:1.19 - name: go build + name: go build windows/386 - commands: - DIST_DIR=$(mktemp -d) - go build -v -trimpath -ldflags="-w -s -X main.AppVersion=$(git describe --tags @@ -175,7 +175,7 @@ steps: GOARCH: amd64 GOOS: darwin image: golang:1.19 - name: go build + name: go build darwin/amd64 - commands: - DIST_DIR=$(mktemp -d) - go build -v -trimpath -ldflags="-w -s -X main.AppVersion=$(git describe --tags @@ -185,7 +185,7 @@ steps: GOARCH: arm64 GOOS: darwin image: golang:1.19 - name: go build + name: go build darwin/arm64 - image: plugins/gitea-release name: create release settings: From 7637a91f71a6e1c92d2ab0033dab45b9f6fa3550 Mon Sep 17 00:00:00 2001 From: Unlock Music Dev Date: Sun, 27 Nov 2022 07:50:04 +0800 Subject: [PATCH 4/4] ci: fix file exist --- .drone.jsonnet | 1 + .drone.yml | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/.drone.jsonnet b/.drone.jsonnet index 6b33dca..4c97a33 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -28,6 +28,7 @@ local StepGoBuild(GOOS, GOARCH) = { 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 cz -f %s -C $DIST_DIR .' % filepath, ], }; diff --git a/.drone.yml b/.drone.yml index eb84a99..f0ffa1a 100644 --- a/.drone.yml +++ b/.drone.yml @@ -14,6 +14,7 @@ steps: - 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 cz -f dist/um-linux-amd64.tar.gz -C $DIST_DIR . environment: GOARCH: amd64 @@ -48,6 +49,7 @@ steps: - 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 cz -f dist/um-windows-amd64.tar.gz -C $DIST_DIR . environment: GOARCH: amd64 @@ -82,6 +84,7 @@ steps: - 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 cz -f dist/um-darwin-amd64.tar.gz -C $DIST_DIR . environment: GOARCH: amd64 @@ -120,6 +123,7 @@ steps: - 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 cz -f dist/um-linux-amd64.tar.gz -C $DIST_DIR . environment: GOARCH: amd64 @@ -130,6 +134,7 @@ steps: - 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 cz -f dist/um-linux-arm64.tar.gz -C $DIST_DIR . environment: GOARCH: arm64 @@ -140,6 +145,7 @@ steps: - 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 cz -f dist/um-linux-386.tar.gz -C $DIST_DIR . environment: GOARCH: "386" @@ -150,6 +156,7 @@ steps: - 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 cz -f dist/um-windows-amd64.tar.gz -C $DIST_DIR . environment: GOARCH: amd64 @@ -160,6 +167,7 @@ steps: - 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 cz -f dist/um-windows-386.tar.gz -C $DIST_DIR . environment: GOARCH: "386" @@ -170,6 +178,7 @@ steps: - 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 cz -f dist/um-darwin-amd64.tar.gz -C $DIST_DIR . environment: GOARCH: amd64 @@ -180,6 +189,7 @@ steps: - 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 cz -f dist/um-darwin-arm64.tar.gz -C $DIST_DIR . environment: GOARCH: arm64