--- kind: pipeline type: docker name: go-auth-ci trigger: branch: - main - develop event: - push - pull_request environment: GOPROXY: https://git.beatrice.wtf/api/packages/panic.haus/go,https://proxy.golang.org,direct GONOSUMDB: git.beatrice.wtf GONOSUMCHECK: git.beatrice.wtf steps: - name: test image: golang:1.26 volumes: - name: go-mod-cache path: /go/pkg/mod commands: - go mod download - go test ./... -count=1 - name: build image: golang:1.26 volumes: - name: go-mod-cache path: /go/pkg/mod commands: - go build ./... volumes: - name: go-mod-cache temp: {} --- kind: pipeline type: docker name: go-auth-release trigger: event: - tag ref: - refs/tags/v* environment: GOPROXY: https://git.beatrice.wtf/api/packages/panic.haus/go,https://proxy.golang.org,direct GONOSUMDB: git.beatrice.wtf GONOSUMCHECK: git.beatrice.wtf steps: - name: test image: golang:1.26 volumes: - name: go-mod-cache path: /go/pkg/mod commands: - go mod download - go test ./... -count=1 - name: build image: golang:1.26 volumes: - name: go-mod-cache path: /go/pkg/mod commands: - go build ./... - name: publish image: golang:1.26 environment: GITEA_TOKEN: from_secret: gitea_token commands: - 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: {}