Compare commits

..

2 Commits

Author SHA1 Message Date
ce9379d166 ci: produce zip for windows build
Some checks reported errors
continuous-integration/drone/push Build encountered an error
2024-10-21 05:46:52 +09:00
ec24497a1c docs: document steps to update CI pipeline 2024-10-21 05:46:27 +09:00
2 changed files with 223 additions and 226 deletions

View File

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

View File

@ -39,5 +39,5 @@ sudo apt install jsonnet yq
2. Update drone CI pipeline: 2. Update drone CI pipeline:
```sh ```sh
jsonnet -y .drone.jsonnet | yq -y > .drone.yml jsonnet .drone.jsonnet | yq -y > .drone.yml
``` ```