fixed release.sh and added help dialog
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
e485e8478c
commit
516d0b74a1
2 changed files with 29 additions and 18 deletions
|
@ -156,7 +156,7 @@ steps:
|
||||||
image: 'cr.44net.ch/baseimages/debian-base'
|
image: 'cr.44net.ch/baseimages/debian-base'
|
||||||
pull: if-not-exists
|
pull: if-not-exists
|
||||||
commands:
|
commands:
|
||||||
- bash 'release.sh' '--get-changelog' '${DRONE_TAG}'
|
- bash 'release.sh' '--get-releasenotes' '${DRONE_TAG}'
|
||||||
|
|
||||||
- name: 'publish gitea release'
|
- name: 'publish gitea release'
|
||||||
image: plugins/gitea-release
|
image: plugins/gitea-release
|
||||||
|
|
41
release.sh
41
release.sh
|
@ -1,18 +1,28 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# script to set the version numbers on all files
|
# script to set the version numbers on all files or generate changelogs for a release
|
||||||
|
|
||||||
# precheck
|
function pre_checks() {
|
||||||
if [[ -z "${1}" ]] || [[ -z "${2}" ]]; then
|
# prechecks
|
||||||
|
if [[ -z "${2}" ]]; then
|
||||||
|
printf 'No version was provided\n'
|
||||||
printf 'Error\n'
|
printf 'Error\n'
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
# set mdlp version
|
||||||
# set mdlp version
|
mdlp_version="${2}"
|
||||||
mdlp_version="${2}"
|
}
|
||||||
|
|
||||||
function show_help(){
|
function show_help(){
|
||||||
return
|
printf 'Script to change the version numbers of mangadlp in the build files, or generate release-notes for a release\n'
|
||||||
|
printf '\nUsage:\n'
|
||||||
|
printf ' ./release.sh <option> <mdlp-version>\n'
|
||||||
|
printf '\nOptions:\n'
|
||||||
|
printf ' --set-version - Set version number on all build files\n'
|
||||||
|
printf ' --get-changelog - Create RELEASENOTES.md for github/gitea release\n'
|
||||||
|
printf '\nExample:\n'
|
||||||
|
printf ' ./release.sh --get-releasenotes "2.0.5"\n'
|
||||||
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
function set_ver_docker() {
|
function set_ver_docker() {
|
||||||
|
@ -43,7 +53,7 @@ function set_ver_pypi() {
|
||||||
}
|
}
|
||||||
|
|
||||||
# set version number in files
|
# set version number in files
|
||||||
function set_version () {
|
function set_version() {
|
||||||
# check for version
|
# check for version
|
||||||
if [[ -z "${mdlp_version}" ]]; then
|
if [[ -z "${mdlp_version}" ]]; then
|
||||||
printf 'You need to specify a version with $1\n'
|
printf 'You need to specify a version with $1\n'
|
||||||
|
@ -58,8 +68,8 @@ function set_version () {
|
||||||
}
|
}
|
||||||
|
|
||||||
# create changelog for release
|
# create changelog for release
|
||||||
function get_changelog () {
|
function get_releasenotes() {
|
||||||
printf 'Creating changelog\n'
|
printf 'Creating release-notes\n'
|
||||||
# check for version
|
# check for version
|
||||||
if [[ -z "${mdlp_version}" ]]; then
|
if [[ -z "${mdlp_version}" ]]; then
|
||||||
printf 'You need to specify a version with $1\n'
|
printf 'You need to specify a version with $1\n'
|
||||||
|
@ -77,14 +87,15 @@ case "${1}" in
|
||||||
show_help
|
show_help
|
||||||
;;
|
;;
|
||||||
'--set-version')
|
'--set-version')
|
||||||
|
pre_checks "${@}"
|
||||||
set_version
|
set_version
|
||||||
;;
|
;;
|
||||||
'--get-changelog')
|
'--get-releasenotes')
|
||||||
get_changelog
|
pre_checks "${@}"
|
||||||
|
get_releasenotes
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
printf 'Error\n'
|
show_help
|
||||||
exit 1
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue