update release action
Some checks failed
check code / check-docs (push) Successful in 6s
check code / check-code-py38 (push) Successful in 26s
check code / check-code-py39 (push) Successful in 27s
check code / check-code-py310 (push) Successful in 22s
check code / check-code-py311 (push) Successful in 24s
check code / scan-code-py311 (push) Has been cancelled

This commit is contained in:
Ivan Schaller 2024-02-21 13:35:37 +01:00
parent 0dc7e2f60d
commit ee8a34b760
2 changed files with 10 additions and 65 deletions

View file

@ -30,30 +30,27 @@ jobs:
- name: build package - name: build package
run: hatch build --clean run: hatch build --clean
- name: create release notes - name: get release notes
run: bash get_release_notes.sh latest id: release-notes
uses: olofvndrhr/releasenote-gen@v1
- name: read changelog
id: changelog
uses: juliangruber/read-file-action@v1
with:
path: ./RELEASENOTES.md
- name: create gitea release - name: create gitea release
uses: https://gitea.com/actions/release-action@main uses: https://gitea.com/actions/release-action@main
if: gitea.event_name != 'pull_request' if: gitea.event_name != 'pull_request'
with: with:
title: ${{ gitea.ref_name }} title: ${{ gitea.ref_name }}
body: ${{ steps.changelog.outputs.content }} body: ${{ steps.release-notes.outputs.releasenotes }}
files: |- files: |-
dist/** dist/**
- name: create github release - name: create github release
uses: softprops/action-gh-release@v1 uses: ncipollo/release-action@v1
if: gitea.event_name != 'pull_request' if: gitea.event_name != 'pull_request'
with: with:
token: ${{ secrets.GH_TOKEN }} token: ${{ secrets.GH_TOKEN }}
title: ${{ gitea.ref_name }} owner: olofvndrhr
body: ${{ steps.changelog.outputs.content }} repo: manga-dlp
files: |- name: ${{ gitea.ref_name }}
body: ${{ steps.release-notes.outputs.releasenotes }}
artifacts: |-
dist/** dist/**

View file

@ -1,52 +0,0 @@
#!/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"
or
./get_release_notes.sh "latest"
EOF
exit 0
}
# create changelog for release
function get_release_notes() {
local l_version="${1}"
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
if [[ ${l_version,,} == "latest" ]]; then
l_version="$(grep -o -E "^##\s\[[0-9]{1,2}.[0-9]{1,2}.[0-9]{1,2}\]" CHANGELOG.md | head -n 1 | grep -o -E "[0-9]{1,2}.[0-9]{1,2}.[0-9]{1,2}")"
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