Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 74fe401261 | |||
| ee53eed048 | |||
| 713668a110 |
84
.drone.yml
84
.drone.yml
@@ -1,58 +1,18 @@
|
|||||||
---
|
---
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: docker
|
type: docker
|
||||||
name: go-core-ci
|
name: go-core
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
branch:
|
|
||||||
- main
|
|
||||||
- develop
|
|
||||||
event:
|
event:
|
||||||
- push
|
- push
|
||||||
- pull_request
|
- 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-core-release
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
event:
|
|
||||||
- tag
|
- tag
|
||||||
ref:
|
|
||||||
- refs/tags/v*
|
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
GOPROXY: https://git.beatrice.wtf/api/packages/panic.haus/go,https://proxy.golang.org,direct
|
GOPRIVATE: git.beatrice.wtf/panic.haus/*
|
||||||
GONOSUMDB: git.beatrice.wtf
|
GONOSUMDB: git.beatrice.wtf/panic.haus/*
|
||||||
GONOSUMCHECK: git.beatrice.wtf
|
GONOSUMCHECK: git.beatrice.wtf/panic.haus/*
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: test
|
- name: test
|
||||||
@@ -72,42 +32,6 @@ steps:
|
|||||||
commands:
|
commands:
|
||||||
- go build ./...
|
- go build ./...
|
||||||
|
|
||||||
- name: publish
|
|
||||||
image: golang:1.26
|
|
||||||
environment:
|
|
||||||
GITEA_TOKEN:
|
|
||||||
from_secret: gitea_token
|
|
||||||
commands:
|
|
||||||
- apt-get update -q && apt-get install -qy 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
|
|
||||||
- |
|
|
||||||
cat > /tmp/mkzip.py << 'PYEOF'
|
|
||||||
import zipfile, os, sys
|
|
||||||
module, version = sys.argv[1], sys.argv[2]
|
|
||||||
prefix = f'{module}@{version}/'
|
|
||||||
with zipfile.ZipFile('/tmp/module.zip', 'w', zipfile.ZIP_DEFLATED) as zf:
|
|
||||||
for root, dirs, files in os.walk('.'):
|
|
||||||
dirs[:] = [d for d in dirs if not d.startswith('.')]
|
|
||||||
for f in files:
|
|
||||||
if f.startswith('.'): continue
|
|
||||||
path = os.path.join(root, f)
|
|
||||||
zf.write(path, prefix + os.path.relpath(path, '.'))
|
|
||||||
print(f'Zip created: {len(zf.namelist())} files')
|
|
||||||
PYEOF
|
|
||||||
- python3 /tmp/mkzip.py "$MODULE" "$VERSION"
|
|
||||||
- |
|
|
||||||
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" -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 "Upload HTTP $HTTP_CODE"
|
|
||||||
[ "$HTTP_CODE" = "201" ] || exit 1
|
|
||||||
- echo "Published $MODULE@$VERSION to Gitea package registry"
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
- name: go-mod-cache
|
- name: go-mod-cache
|
||||||
temp: {}
|
temp: {}
|
||||||
|
|||||||
Reference in New Issue
Block a user