ci: publish Go module to Gitea package registry on tag
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
49
.drone.yml
49
.drone.yml
@@ -12,21 +12,32 @@ trigger:
|
|||||||
- pull_request
|
- pull_request
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
GOPRIVATE: git.beatrice.wtf/panic.haus/*
|
GOPROXY: https://git.beatrice.wtf/api/packages/panic.haus/go,https://proxy.golang.org,direct
|
||||||
GONOSUMDB: git.beatrice.wtf/panic.haus/*
|
GONOSUMDB: git.beatrice.wtf
|
||||||
|
GONOSUMCHECK: git.beatrice.wtf
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: test
|
- name: test
|
||||||
image: golang:1.26
|
image: golang:1.26
|
||||||
|
volumes:
|
||||||
|
- name: go-mod-cache
|
||||||
|
path: /go/pkg/mod
|
||||||
commands:
|
commands:
|
||||||
- go mod download
|
- go mod download
|
||||||
- go test ./... -count=1
|
- go test ./... -count=1
|
||||||
|
|
||||||
- name: build
|
- name: build
|
||||||
image: golang:1.26
|
image: golang:1.26
|
||||||
|
volumes:
|
||||||
|
- name: go-mod-cache
|
||||||
|
path: /go/pkg/mod
|
||||||
commands:
|
commands:
|
||||||
- go build ./...
|
- go build ./...
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- name: go-mod-cache
|
||||||
|
temp: {}
|
||||||
|
|
||||||
---
|
---
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: docker
|
type: docker
|
||||||
@@ -39,22 +50,48 @@ trigger:
|
|||||||
- refs/tags/v*
|
- refs/tags/v*
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
GOPRIVATE: git.beatrice.wtf/panic.haus/*
|
GOPROXY: https://git.beatrice.wtf/api/packages/panic.haus/go,https://proxy.golang.org,direct
|
||||||
GONOSUMDB: git.beatrice.wtf/panic.haus/*
|
GONOSUMDB: git.beatrice.wtf
|
||||||
|
GONOSUMCHECK: git.beatrice.wtf
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: test
|
- name: test
|
||||||
image: golang:1.26
|
image: golang:1.26
|
||||||
|
volumes:
|
||||||
|
- name: go-mod-cache
|
||||||
|
path: /go/pkg/mod
|
||||||
commands:
|
commands:
|
||||||
- go mod download
|
- go mod download
|
||||||
- go test ./... -count=1
|
- go test ./... -count=1
|
||||||
|
|
||||||
- name: build
|
- name: build
|
||||||
image: golang:1.26
|
image: golang:1.26
|
||||||
|
volumes:
|
||||||
|
- name: go-mod-cache
|
||||||
|
path: /go/pkg/mod
|
||||||
commands:
|
commands:
|
||||||
- go build ./...
|
- go build ./...
|
||||||
|
|
||||||
- name: warm-proxy
|
- name: publish
|
||||||
image: golang:1.26
|
image: golang:1.26
|
||||||
|
environment:
|
||||||
|
GITEA_TOKEN:
|
||||||
|
from_secret: gitea_token
|
||||||
commands:
|
commands:
|
||||||
- go list -m git.beatrice.wtf/panic.haus/go-core@${DRONE_TAG}
|
- apt-get update -q && apt-get install -qy zip python3
|
||||||
|
- MODULE=$(go mod edit -json | python3 -c "import json,sys; print(json.load(sys.stdin)['Module']['Path'])")
|
||||||
|
- VERSION=${DRONE_TAG}
|
||||||
|
- echo "Publishing $MODULE@$VERSION"
|
||||||
|
- go mod download
|
||||||
|
- go mod zip /tmp/module.zip "$MODULE@$VERSION"
|
||||||
|
- |
|
||||||
|
curl -sf -X PUT \
|
||||||
|
"https://git.beatrice.wtf/api/packages/panic.haus/go/upload" \
|
||||||
|
-H "Authorization: token $GITEA_TOKEN" \
|
||||||
|
-H "Content-Type: application/zip" \
|
||||||
|
--data-binary "@/tmp/module.zip"
|
||||||
|
- echo "Published $MODULE@$VERSION to Gitea package registry"
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- name: go-mod-cache
|
||||||
|
temp: {}
|
||||||
|
|||||||
Reference in New Issue
Block a user