kind: pipeline type: docker name: build-and-release steps: - name: build image: golang:1.23 environment: CGO_ENABLED: 0 GOOS: linux GOARCH: amd64 commands: - go build -o camcap camcap.go - name: publish-release image: curlimages/curl environment: GOGS_TOKEN: from_secret: gogs_key GOGS_API: https://code.unbl.ink/api/v1 REPO: secstate/camcap TAG: ${DRONE_TAG:=build-$(date -u +%Y%m%d%H%M%S)} commands: # Create release (if it doesn't exist yet) - | curl -s -X POST "$GOGS_API/repos/$REPO/releases" \ -H "Content-Type: application/json" \ -H "Authorization: token $GOGS_TOKEN" \ -d "{\"tag_name\": \"$TAG\", \"name\": \"$TAG\", \"draft\": false, \"prerelease\": false}" \ || echo "Release may already exist" # Upload artifact to release - | curl -s -X POST "$GOGS_API/repos/$REPO/releases/tags/$TAG/assets" \ -H "Authorization: token $GOGS_TOKEN" \ -F "attachment=@camcap" \ || echo "Upload failed"