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,6 +1,6 @@
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
@ -13,8 +13,8 @@ steps:
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:
@ -34,23 +34,22 @@ steps:
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 --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
- zip -9 -j -r "dist/um-windows-amd64.zip" $DIST_DIR - zip -9 -j -r "dist/um-windows-amd64.zip" $DIST_DIR
environment: environment:
@ -70,23 +69,22 @@ steps:
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 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
--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-darwin-amd64.tar.gz" - tar -zc -C $DIST_DIR um | gzip -9 > "dist/um-darwin-amd64.tar.gz"
environment: environment:
@ -106,15 +104,14 @@ steps:
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: release
name: release steps:
steps:
- commands: - commands:
- git fetch --tags - git fetch --tags
image: alpine/git image: alpine/git
@ -127,8 +124,8 @@ steps:
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:
@ -139,8 +136,8 @@ steps:
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
--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-arm64.tar.gz" - tar -zc -C $DIST_DIR um | gzip -9 > "dist/um-linux-arm64.tar.gz"
environment: environment:
@ -151,8 +148,8 @@ steps:
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
--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-386.tar.gz" - tar -zc -C $DIST_DIR um | gzip -9 > "dist/um-linux-386.tar.gz"
environment: environment:
@ -163,8 +160,8 @@ steps:
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
--always)" -o $DIST_DIR ./cmd/um --tags --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:
@ -175,8 +172,8 @@ steps:
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
--always)" -o $DIST_DIR ./cmd/um --tags --always)" -o $DIST_DIR ./cmd/um
- mkdir -p dist - mkdir -p dist
- zip -9 -j -r "dist/um-windows-386.zip" $DIST_DIR - zip -9 -j -r "dist/um-windows-386.zip" $DIST_DIR
environment: environment:
@ -187,8 +184,8 @@ steps:
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
--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-darwin-amd64.tar.gz" - tar -zc -C $DIST_DIR um | gzip -9 > "dist/um-darwin-amd64.tar.gz"
environment: environment:
@ -199,8 +196,8 @@ steps:
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
--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-darwin-arm64.tar.gz" - tar -zc -C $DIST_DIR um | gzip -9 > "dist/um-darwin-arm64.tar.gz"
environment: environment:
@ -219,7 +216,7 @@ steps:
draft: true draft: true
files: dist/* files: dist/*
title: ${DRONE_TAG} title: ${DRONE_TAG}
trigger: trigger:
event: event:
- tag - tag
type: docker 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
``` ```