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'
|
||||
pull: if-not-exists
|
||||
commands:
|
||||
- bash 'release.sh' '--get-changelog' '${DRONE_TAG}'
|
||||
- bash 'release.sh' '--get-releasenotes' '${DRONE_TAG}'
|
||||
|
||||
- name: 'publish gitea release'
|
||||
image: plugins/gitea-release
|
||||
|
|
33
release.sh
33
release.sh
|
@ -1,18 +1,28 @@
|
|||
#!/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
|
||||
if [[ -z "${1}" ]] || [[ -z "${2}" ]]; then
|
||||
function pre_checks() {
|
||||
# prechecks
|
||||
if [[ -z "${2}" ]]; then
|
||||
printf 'No version was provided\n'
|
||||
printf 'Error\n'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# set mdlp version
|
||||
mdlp_version="${2}"
|
||||
}
|
||||
|
||||
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() {
|
||||
|
@ -58,8 +68,8 @@ function set_version () {
|
|||
}
|
||||
|
||||
# create changelog for release
|
||||
function get_changelog () {
|
||||
printf 'Creating changelog\n'
|
||||
function get_releasenotes() {
|
||||
printf 'Creating release-notes\n'
|
||||
# check for version
|
||||
if [[ -z "${mdlp_version}" ]]; then
|
||||
printf 'You need to specify a version with $1\n'
|
||||
|
@ -77,14 +87,15 @@ case "${1}" in
|
|||
show_help
|
||||
;;
|
||||
'--set-version')
|
||||
pre_checks "${@}"
|
||||
set_version
|
||||
;;
|
||||
'--get-changelog')
|
||||
get_changelog
|
||||
'--get-releasenotes')
|
||||
pre_checks "${@}"
|
||||
get_releasenotes
|
||||
;;
|
||||
*)
|
||||
printf 'Error\n'
|
||||
exit 1
|
||||
show_help
|
||||
;;
|
||||
esac
|
||||
|
||||
|
|
Loading…
Reference in a new issue