This commit is contained in:
parent
3e470e100e
commit
9d127581ef
6 changed files with 77 additions and 134 deletions
18
.bumpversion.cfg
Normal file
18
.bumpversion.cfg
Normal file
|
@ -0,0 +1,18 @@
|
|||
[bumpversion]
|
||||
current_version = 2.1.5
|
||||
commit = False
|
||||
tag = False
|
||||
serialize = {major}.{minor}.{patch}
|
||||
|
||||
[bumpversion:file:pyproject.toml]
|
||||
search = {current_version}
|
||||
replace = {new_version}
|
||||
|
||||
[bumpversion:file:mangadlp/input.py]
|
||||
search = {current_version}
|
||||
replace = {new_version}
|
||||
|
||||
[bumpversion:file:manga-dlp.py]
|
||||
search = {current_version}
|
||||
replace = {new_version}
|
||||
|
|
@ -21,7 +21,7 @@ pipeline:
|
|||
when:
|
||||
#branch: master
|
||||
event: tag
|
||||
image: 'cr.44net.ch/baseimages/debian-base'
|
||||
image: cr.44net.ch/baseimages/debian-base
|
||||
pull: true
|
||||
commands:
|
||||
- tar -czf manga-dlp-${CI_COMMIT_TAG}.tar.gz --files-from=release-files.txt
|
||||
|
@ -31,10 +31,10 @@ pipeline:
|
|||
when:
|
||||
#branch: master
|
||||
event: tag
|
||||
image: 'cr.44net.ch/baseimages/debian-base'
|
||||
image: cr.44net.ch/baseimages/debian-base
|
||||
pull: true
|
||||
commands:
|
||||
- bash 'release.sh' '--get-releasenotes' '${CI_COMMIT_TAG}'
|
||||
- bash 'get_release_notes.sh' '${CI_COMMIT_TAG}'
|
||||
|
||||
# publish release on gitea (git.44net.ch/olofvndrhr/manga-dlp)
|
||||
publish-release-gitea:
|
||||
|
@ -48,7 +48,7 @@ pipeline:
|
|||
from_secret: gitea-olofvndrhr-token
|
||||
base_url: https://git.44net.ch
|
||||
files: manga-dlp-${CI_COMMIT_TAG}.tar.gz
|
||||
title: '${CI_COMMIT_TAG}'
|
||||
title: ${CI_COMMIT_TAG}
|
||||
note: RELEASENOTES.md
|
||||
|
||||
# publish release on github (github.com/olofvndrhr/manga-dlp)
|
||||
|
@ -62,5 +62,5 @@ pipeline:
|
|||
api_key:
|
||||
from_secret: github-olofvndrhr-token
|
||||
files: manga-dlp-${CI_COMMIT_TAG}.tar.gz
|
||||
title: '${CI_COMMIT_TAG}'
|
||||
title: ${CI_COMMIT_TAG}
|
||||
note: RELEASENOTES.md
|
||||
|
|
|
@ -12,35 +12,35 @@ pipeline:
|
|||
|
||||
# check code style - shell
|
||||
test-shfmt:
|
||||
image: 'cr.44net.ch/drone-plugins/test'
|
||||
image: cr.44net.ch/drone-plugins/test
|
||||
pull: true
|
||||
commands:
|
||||
- shfmt -d -i 4 -bn -ci -sr .
|
||||
|
||||
# check code style - python
|
||||
test-black:
|
||||
image: 'cr.44net.ch/drone-plugins/test'
|
||||
image: cr.44net.ch/drone-plugins/test
|
||||
pull: true
|
||||
commands:
|
||||
- black --check --diff .
|
||||
|
||||
# check imports - python
|
||||
test-isort:
|
||||
image: 'cr.44net.ch/drone-plugins/test'
|
||||
image: cr.44net.ch/drone-plugins/test
|
||||
pull: true
|
||||
commands:
|
||||
- isort --check-only --diff .
|
||||
|
||||
# check static typing - python
|
||||
test-mypy:
|
||||
image: 'cr.44net.ch/drone-plugins/test'
|
||||
image: cr.44net.ch/drone-plugins/test
|
||||
pull: true
|
||||
commands:
|
||||
- mypy --install-types --non-interactive mangadlp/
|
||||
|
||||
# test code and generate coverage report
|
||||
test-coverage-pytest:
|
||||
image: 'cr.44net.ch/drone-plugins/test'
|
||||
image: cr.44net.ch/drone-plugins/test
|
||||
pull: true
|
||||
commands:
|
||||
- pip install -r requirements.txt
|
||||
|
@ -52,10 +52,10 @@ pipeline:
|
|||
sonarqube-analysis:
|
||||
when:
|
||||
branch: master
|
||||
image: 'cr.44net.ch/drone-plugins/sonarqube'
|
||||
image: cr.44net.ch/drone-plugins/sonarqube
|
||||
pull: true
|
||||
settings:
|
||||
sonar_host: 'https://sonarqube.44net.ch'
|
||||
sonar_host: https://sonarqube.44net.ch
|
||||
sonar_token:
|
||||
from_secret: sq-44net-token
|
||||
usingProperties: true
|
||||
|
|
|
@ -2,7 +2,7 @@ version: "3"
|
|||
services:
|
||||
|
||||
manga-dlp:
|
||||
image: olofvndrhr/manga-dlp:latest
|
||||
image: olofvndrhr/manga-dlp:2.1.5
|
||||
container_name: manga-dlp
|
||||
restart: unless-stopped
|
||||
security_opt:
|
||||
|
|
46
get_release_notes.sh.sh
Executable file
46
get_release_notes.sh.sh
Executable file
|
@ -0,0 +1,46 @@
|
|||
#!/bin/bash
|
||||
# shellcheck disable=SC2016
|
||||
|
||||
# script to extract the release notes from the changelog
|
||||
|
||||
# show script help
|
||||
function show_help() {
|
||||
cat << EOF
|
||||
|
||||
Script to generate release-notes from a changelog (CHANGELOG.md)
|
||||
Usage:
|
||||
./get_release_notes.sh <new_version>
|
||||
|
||||
|
||||
Example:
|
||||
./get_release_notes.sh "2.0.5"
|
||||
|
||||
EOF
|
||||
exit 0
|
||||
}
|
||||
|
||||
# create changelog for release
|
||||
function get_release_notes() {
|
||||
local l_version
|
||||
|
||||
printf 'Creating release-notes\n'
|
||||
# check for version
|
||||
if [[ -z "${l_version}" ]]; then
|
||||
printf 'You need to specify a version with $1\n'
|
||||
exit 1
|
||||
fi
|
||||
awk -v ver="[${l_version}]" \
|
||||
'/^## / { if (p) { exit }; if ($2 == ver) { p=1 } } p && NF' \
|
||||
'CHANGELOG.md' > 'RELEASENOTES.md'
|
||||
printf 'Done\n'
|
||||
}
|
||||
|
||||
# check options
|
||||
case "${1}" in
|
||||
'--help' | '-h' | 'help')
|
||||
show_help
|
||||
;;
|
||||
*)
|
||||
get_release_notes "${@}"
|
||||
;;
|
||||
esac
|
121
release.sh
121
release.sh
|
@ -1,121 +0,0 @@
|
|||
#!/bin/bash
|
||||
# shellcheck disable=SC2016
|
||||
|
||||
# script to set the version numbers on all files or generate changelogs for a release
|
||||
|
||||
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() {
|
||||
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() {
|
||||
printf 'Changing version in docker-files\n'
|
||||
local docker_files docker_regex
|
||||
docker_files=(
|
||||
'docker/Dockerfile.amd64'
|
||||
'docker/Dockerfile.arm64'
|
||||
)
|
||||
docker_regex='s,^ENV MDLP_VERSION=.*$,ENV MDLP_VERSION='"${mdlp_version}"',g'
|
||||
for file in "${docker_files[@]}"; do
|
||||
if ! sed -i "${docker_regex}" "${file}"; then return 1; fi
|
||||
done
|
||||
printf 'Done\n'
|
||||
}
|
||||
|
||||
function set_ver_pypi() {
|
||||
printf 'Changing version in pypi-files\n'
|
||||
local pypi_files pypi_regex
|
||||
pypi_files=(
|
||||
'setup.py'
|
||||
)
|
||||
pypi_regex='s/version=.*$/version=\"'"${mdlp_version}"'\",/g'
|
||||
for file in "${pypi_files[@]}"; do
|
||||
if ! sed -i "${pypi_regex}" "${file}"; then return 1; fi
|
||||
done
|
||||
printf 'Done\n'
|
||||
}
|
||||
|
||||
function set_ver_project() {
|
||||
printf 'Changing version in project-files\n'
|
||||
local project_files project_regex
|
||||
project_files=(
|
||||
'mangadlp/input.py'
|
||||
'manga-dlp.py'
|
||||
)
|
||||
project_regex='s/mangadlp_version =.*$/mangadlp_version = \"'"${mdlp_version}"'\"/g'
|
||||
for file in "${project_files[@]}"; do
|
||||
if ! sed -i "${project_regex}" "${file}"; then return 1; fi
|
||||
done
|
||||
printf 'Done\n'
|
||||
}
|
||||
|
||||
# set version number in files
|
||||
function set_version() {
|
||||
# check for version
|
||||
if [[ -z "${mdlp_version}" ]]; then
|
||||
printf 'You need to specify a version with $1\n'
|
||||
exit 1
|
||||
fi
|
||||
# set docker versions
|
||||
if ! set_ver_docker; then
|
||||
printf 'Docker: Error\n'
|
||||
fi
|
||||
# set pypi versions
|
||||
if ! set_ver_pypi; then
|
||||
printf 'PyPi: Error\n'
|
||||
fi
|
||||
# set project versions
|
||||
if ! set_ver_project; then
|
||||
printf 'Project: Error\n'
|
||||
fi
|
||||
}
|
||||
|
||||
# create changelog for release
|
||||
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'
|
||||
exit 1
|
||||
fi
|
||||
awk -v ver="[${mdlp_version}]" \
|
||||
'/^## / { if (p) { exit }; if ($2 == ver) { p=1 } } p && NF' \
|
||||
'CHANGELOG.md' > 'RELEASENOTES.md'
|
||||
printf 'Done\n'
|
||||
}
|
||||
|
||||
# check options
|
||||
case "${1}" in
|
||||
'--help' | '-h' | 'help')
|
||||
show_help
|
||||
;;
|
||||
'--set-version')
|
||||
pre_checks "${@}"
|
||||
set_version
|
||||
;;
|
||||
'--get-releasenotes')
|
||||
pre_checks "${@}"
|
||||
get_releasenotes
|
||||
;;
|
||||
*)
|
||||
show_help
|
||||
;;
|
||||
esac
|
Loading…
Reference in a new issue