variables: # Package version can only contain numbers (0-9), and dots (.). # Must be in the format of X.Y.Z, i.e. should match /\A\d+\.\d+\.\d+\z/ regular expresion. # See https://docs.gitlab.com/ee/user/packages/generic_packages/#publish-a-package-file PACKAGE_VERSION: "1.2.3" LINUX_AMD64_BINARY: "console-${PACKAGE_VERSION}" PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/cobalt-strike/${PACKAGE_VERSION}" stages: - build - upload - release cache: # 缓存 paths: - bin job_build: stage: build image: golang:latest script: - go build -o console-${PACKAGE_VERSION} console.go artifacts: paths: - bin upload: stage: upload image: curlimages/curl:latest script: - ls . - ls bin - | curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file ${LINUX_AMD64_BINARY} "${PACKAGE_REGISTRY_URL}/${LINUX_AMD64_BINARY}" release: # Caution, as of 2021-02-02 these assets links require a login, see: # https://gitlab.com/gitlab-org/gitlab/-/issues/299384 stage: release image: registry.gitlab.com/gitlab-org/release-cli:latest script: - | release-cli create --name "Release $CI_COMMIT_TAG" --tag-name $CI_COMMIT_TAG \ --assets-link "{\"name\":\"${LINUX_AMD64_BINARY}\",\"url\":\"${PACKAGE_REGISTRY_URL}/${LINUX_AMD64_BINARY}\"}"