README ¶
for what
- drone CI release for gitea and
must with git tag push
support conventional-commits log
Contributing
We welcome community contributions to this project.
Please read Contributor Guide for more information on how to get started.
请阅读有关 贡献者指南 以获取更多如何入门的信息## Features
Features
- release for gitea and
only support with git tag
pushed - gitea client token use Access Token
- upload release files by glob pattern
- support generate check sum file by
md5 sha1 sha256 sha512 crc32 ...
- check sum file support tools as
md5sum sha1sum sha256sum sha512sum
- generate file base name dot not duplicates by base name
- check sum file support tools as
- support conventional-commits log from
CHANGELOG.md
- from lib github.com/convention-change/convention-change-log
- the same support www.contributor-covenant.org change logs
- can use dry-run mode (support v1.4.+)
- publish package support
- go package publish, must update gitea:1.20.1+ and set
gitea_publish_package_go
totrue
doc see https://docs.gitea.com/usage/packages/go - when go package publish, can remove folder by
gitea_publish_go_remove_paths
orPLUGIN_GITEA_PUBLISH_GO_REMOVE_PATHS
(support v1.3.+)
- go package publish, must update gitea:1.20.1+ and set
- more perfect test case coverage
- more see CHANGELOG.md
usage
- read conventional-commits log
- get your gitea Access Token
for
release_gitea_api_key
- add
.drone.yml
config as pipeline
Pipeline Settings (.drone.yml)
1.x
- fast use as docker
kind: pipeline
type: docker
name: basic-docker
steps:
- name: gitea-cc-release
image: sinlov/drone-gitea-cc-release:1.4.0 # https://hub.docker.com/r/sinlov/drone-gitea-cc-release/tags
pull: if-not-exists
settings:
# dry_run: false # default false
prerelease: true # default true
release_gitea_base_url: https://gitea.xxxx.com
release_gitea_api_key:
from_secret: release_gitea_api_key
release_gitea_files: # release as files by glob pattern
- "doc/*.md"
release_gitea_files_checksum: # generate specific checksums, support [ md5 sha1 sha256 sha512 adler32 crc32 blake2b blake2s ]
- md5
- sha1
- sha256
release_gitea_file_exists_do: "overwrite" # default skip, support [ fail skip overwrite ]
release_gitea_note_by_convention_change: true # default false, like tools https://github.com/convention-change/convention-change-log read change log
# gitea_publish_package_go: true # gitea 1.20.1+ support publish go package, default false
# gitea_publish_package_path_go: "" # publish go package dir to find go.mod, if not set will use git root path
# gitea_publish_go_remove_paths: ['dist'] # publish go package remove paths, this path under gitea_publish_package_path_go, vars like dist,target
when:
event: # https://docs.drone.io/pipeline/exec/syntax/conditions/#by-event
- tag
- full config
kind: pipeline
type: docker
name: basic-docker
steps:
- name: gitea-cc-release
image: sinlov/drone-gitea-cc-release:1.4.0 # https://hub.docker.com/r/sinlov/drone-gitea-cc-release/tags
pull: if-not-exists
settings:
# debug: true # plugin debug switch
# dry_run: false # default false
prerelease: true # default true
draft: true # default false
release_gitea_base_url: https://gitea.xxxx.com
release_gitea_api_key:
from_secret: release_gitea_api_key
# release_gitea_insecure: false # default false, visit base-url via insecure https protocol
release_gitea_file_root_path: "" # release as files by glob pattern root path, if not setting will get cwd folder by PLUGIN_RELEASE_GITEA_ROOT_FOLDER_PATH
release_gitea_files: # release as files by glob pattern
- "doc/*.md"
- "**/*.zip"
release_gitea_files_checksum: # generate specific checksums, support [ md5 sha1 sha256 sha512 adler32 crc32 blake2b blake2s ]
- md5
- sha1
- sha256
release_gitea_file_exists_do: "overwrite" # default skip, support [ fail skip overwrite ]
release_gitea_note_by_convention_change: true # default false, like tools https://github.com/convention-change/convention-change-log read change log
# release_read_change_log_file: CHANGELOG.md # default CHANGELOG.md
# release_gitea_title: "" # if set release_gitea_note_by_convention_change true will cover this, use "" will use tag
# release_gitea_note: "" # if set release_gitea_note_by_convention_change true will cover this
gitea_publish_package_go: true # gitea 1.20.1+ support publish go package, default false
gitea_publish_package_path_go: "" # publish go package dir to find go.mod, if not set will use git root path
gitea_publish_go_remove_paths: ['dist'] # publish go package remove paths, this path under gitea_publish_package_path_go, vars like dist,target
when:
event: # https://docs.drone.io/pipeline/exec/syntax/conditions/#by-event
- tag
1.x
drone-exec only support env- download by https://github.com/convention-change/drone-gitea-cc-release/releases to get platform binary, then has local path
- binary path like
C:\Drone\drone-runner-exec\plugins\drone-feishu-group-robot.exe
can be drone run env likeEXEC_DRONE_GITEA-CC-RELEASE
- env:EXEC_DRONE_GITEA-CC-RELEASE can set at file which define as DRONE_RUNNER_ENVFILE to support each platform to send feishu message
steps:
- name: notification-feishu-group-robot-exec # must has env EXEC_DRONE_GITEA-CC-RELEASE and exec tools
environment:
# PLUGIN_DEBUG: false
PLUGIN_DRY_RUN: false # default false
PLUGIN_PRERELEASE: true # default true
PLUGIN_DRAFT: true # default false
PLUGIN_RELEASE_GITEA_BASE_URL: https://gitea.xxxx.com
PLUGIN_RELEASE_GITEA_API_KEY:
from_secret: release_gitea_api_key
# PLUGIN_RELEASE_GITEA_INSECURE: false # default false, visit base-url via insecure https protocol
# PLUGIN_RELEASE_GITEA_FILE_ROOT_PATH: "" # release as files by glob pattern root path, if not setting will get cwd folder by PLUGIN_RELEASE_GITEA_ROOT_FOLDER_PATH
PLUGIN_RELEASE_GITEA_FILES: "doc/*.md,**/*.zip" # release as files by glob pattern
PLUGIN_RELEASE_GITEA_FILES_CHECKSUM: "md5,sha1,sha256" # generate specific checksums, support [ md5 sha1 sha256 sha512 adler32 crc32 blake2b blake2s ]
PLUGIN_RELEASE_GITEA_FILE_EXISTS_DO: "overwrite" # default skip, support [ fail skip overwrite ]
PLUGIN_RELEASE_GITEA_NOTE_BY_CONVENTION_CHANGE: true # default false, like tools https://github.com/convention-change/convention-change-log read change log
# PLUGIN_RELEASE_READ_CHANGE_LOG_FILE: CHANGELOG.md # default CHANGELOG.md
PLUGIN_RELEASE_GITEA_TITLE: "" # if set release_gitea_note_by_convention_change true will cover this, use "" will use tag
PLUGIN_RELEASE_GITEA_NOTE: "" # if set release_gitea_note_by_convention_change true will cover this
# PLUGIN_GITEA_PUBLISH_PACKAGE_GO: true # gitea 1.20.1+ support publish go package, default false
# PLUGIN_GITEA_PUBLISH_PACKAGE_PATH_GO: "" # publish go package dir to find go.mod, if not set will use git root path
# PLUGIN_GITEA_PUBLISH_GO_REMOVE_PATHS: "dist" # publish go package remove paths, this path under gitea_publish_package_path_go, vars like dist,target
commands:
- ${EXEC_DRONE_GITEA-CC-RELEASE} `
""
when:
event: # https://docs.drone.io/pipeline/exec/syntax/conditions/#by-event
- tag
install cli tools
# install at ${GOPATH}/bin
$ go install -v github.com/convention-change/drone-gitea-cc-release/cmd/drone-gitea-cc-release@latest
# install version v1.4.0
$ go install -v github.com/convention-change/drone-gitea-cc-release/cmd/drone-gitea-cc-release@v1.4.0
or download by github releases
env
- minimum go version: go 1.20
- change
go 1.20
,^1.20
,1.20.7
to new go version
libs
lib | version |
---|---|
https://github.com/stretchr/testify | v1.8.4 |
https://github.com/sebdah/goldie | v2.5.3 |
https://github.com/joho/godotenv | v1.4.0 |
https://gitea.com/gitea/go-sdk | v0.15.1 |
dev
depends
in go mod project
# warning use private git host must set
# global set for once
# add private git host like github.com to evn GOPRIVATE
$ go env -w GOPRIVATE='github.com'
# use ssh proxy
# set ssh-key to use ssh as http
$ git config --global url."git@github.com:".insteadOf "https://github.com/"
# or use PRIVATE-TOKEN
# set PRIVATE-TOKEN as gitlab or gitea
$ git config --global http.extraheader "PRIVATE-TOKEN: {PRIVATE-TOKEN}"
# set this rep to download ssh as https use PRIVATE-TOKEN
$ git config --global url."ssh://github.com/".insteadOf "https://github.com/"
# before above global settings
# test version info
$ git ls-remote -q https://github.com/convention-change/drone-gitea-cc-release.git
# test depends see full version
$ go list -mod=readonly -v -m -versions github.com/convention-change/drone-gitea-cc-release
# or use last version add go.mod by script
$ echo "go mod edit -require=$(go list -mod=readonly -m -versions github.com/convention-change/drone-gitea-cc-release | awk '{print $1 "@" $NF}')"
$ echo "go mod vendor"
make init dep
- see help
$ make devHelp
- test code
add env then test
export PLUGIN_MSG_TYPE=post \
export PLUGIN_WEBHOOK=7138d7b3-abc
$ make test testBenchmark
- full env example
export PLUGIN_MSG_TYPE= \
export PLUGIN_WEBHOOK= \
export DRONE_REPO=convention-change/drone-gitea-cc-release \
export DRONE_REPO_NAME=drone-gitea-cc-release \
export DRONE_REPO_NAMESPACE=convention-change \
export DRONE_REMOTE_URL=https://github.com/convention-change/drone-gitea-cc-release \
export DRONE_REPO_OWNER=convention-change \
export DRONE_COMMIT_AUTHOR=convention-change \
export DRONE_COMMIT_AUTHOR_AVATAR= \
export DRONE_COMMIT_AUTHOR_EMAIL=convention-changegmppt@gmail.com \
export DRONE_COMMIT_BRANCH=main \
export DRONE_COMMIT_LINK=https://github.com/convention-change/drone-gitea-cc-release/commit/68e3d62dd69f06077a243a1db1460109377add64 \
export DRONE_COMMIT_SHA=68e3d62dd69f06077a243a1db1460109377add64 \
export DRONE_COMMIT_REF=refs/heads/main \
export DRONE_COMMIT_MESSAGE="mock message commit" \
export DRONE_STAGE_STARTED=1674531206 \
export DRONE_STAGE_FINISHED=1674532106 \
export DRONE_BUILD_STATUS=success \
export DRONE_BUILD_NUMBER=1 \
export DRONE_BUILD_LINK=https://drone.xxx.com/convention-change/drone-gitea-cc-release/1 \
export DRONE_BUILD_EVENT=push \
export DRONE_BUILD_STARTED=1674531206 \
export DRONE_BUILD_FINISHED=1674532206
- then run
$ make run
- ci to fast check
$ make ci
docker
# then test build as test/Dockerfile
$ make dockerTestRestartLatest
# if run error
# like this error
# err: missing webhook, please set webhook
# fix env settings then test
# see run docker fast
$ make dockerTestRunLatest
# clean test build
$ make dockerTestPruneLatest
# see how to use
$ docker run --rm convention-change/drone-gitea-cc-release:latest -h
Documentation ¶
Click to show internal directories.
Click to hide internal directories.