Skip to content

Add workflow to draft release notes #2

Add workflow to draft release notes

Add workflow to draft release notes #2

Workflow file for this run

name: release-notes
on:
push:
branches:
- main
- release-notes
jobs:
draft-release-notes:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
set -o errexit
set -o nounset
set -o pipefail
set -x
latest_tag="$(gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /repos/timebertt/kubernetes-controller-sharding/releases/latest --jq .tag_name)"
major="$(echo "$latest_tag" | cut -d. -f1)"
minor="$(echo "$latest_tag" | cut -d. -f2)"
new_tag="$major.$((minor+1)).0"
if [ "$(gh release view "$new_tag" --json isDraft --jq .isDraft)" = true ] ; then
# clean up previous draft release
gh release delete -y "$new_tag"
fi
gh release create "$new_tag" --draft --generate-notes --notes-start-tag="${latest_tag%.*}.0"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}