Skip to content

Commit

Permalink
Add changelog generation to pre-release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
hairyhum committed Apr 10, 2024
1 parent 9b35347 commit a05289f
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 9 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,22 @@ jobs:
- name: restore_gosum
run: echo "${{needs.gomod.outputs.gosum}}" > go.sum
- run: make golint

reno_lint:
runs-on: ubuntu-20.04
needs: gomod
steps:
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
with:
fetch-depth: 0
- name: reset_git_extension
run: git config --unset-all extensions.worktreeconfig
- name: reno_lint
run: make reno-lint
## Reno lint does not catch some errors which make reno report fail
- name: reno_report_check
run: make reno-report

test:
runs-on: ubuntu-20.04
needs: gomod
Expand Down
13 changes: 11 additions & 2 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,26 @@ jobs:
export CURRENT_TAG=$(git describe --abbrev=0 --tags)
echo ./build/bump_version.sh "${CURRENT_TAG}" "${RELEASE_TAG}"
./build/bump_version.sh "${CURRENT_TAG}" "${RELEASE_TAG}"
make reno-report VERSION="${RELEASE_TAG}"
- name: commit_changes
run: |
git config --global user.name 'Kasten Production'
git config --global user.email '[email protected]'
git checkout -B "kan-docs-${PRERELEASE_DOCS_BRANCH}-${RELEASE_TAG}"
git add -A
git commit -s -m "pre-release: Update version to ${RELEASE_TAG}"
- name: push_changes
run: git push origin "kan-docs-${PRERELEASE_DOCS_BRANCH}-${RELEASE_TAG}"
- name: create_pr_body
run: |
echo "Update version to ${RELEASE_TAG}" > PR_BODY_FILE
echo "" > PR_BODY_FILE
echo "Please check the changelog for the following merges:" >> PR_BODY_FILE
export CURRENT_TAG=$(git describe --abbrev=0 --tags)
git log ${CURRENT_TAG}..kan-docs-${PRERELEASE_DOCS_BRANCH}-${RELEASE_TAG} --pretty="- %h: %s" | grep -v ': test' | grep -v ': doc' | grep -v ': build' | grep -v ': deps' >> PR_BODY_FILE
- name: create_pr
run: |
git push origin "kan-docs-${PRERELEASE_DOCS_BRANCH}-${RELEASE_TAG}"
gh pr create --title "pre-release: Update version to ${RELEASE_TAG}" --body "Update version to ${RELEASE_TAG}" --head "kan-docs-${PRERELEASE_DOCS_BRANCH}-${RELEASE_TAG}" --base master --reviewer tdmanv,pavannd1,viveksinghggits --label kueue
gh pr create --title "pre-release: Update version to ${RELEASE_TAG}" -F PR_BODY_FILE --head "kan-docs-${PRERELEASE_DOCS_BRANCH}-${RELEASE_TAG}" --base master --reviewer tdmanv,pavannd1,viveksinghggits,hairyhum --label kueue
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}

4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@
/dist
**/*.swp
/.idea
/releasenotes/config.yaml
/releasenotes/config.yaml
CHANGELOG.rst
CHANGELOG_CURRENT.rst
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -292,4 +292,7 @@ reno-new:
@$(MAKE) run CMD="reno new $(note)"

reno-report:
@$(MAKE) run CMD="./build/reno_report.sh $(VERSION)"
@$(MAKE) run CMD="./build/reno_report.sh $(VERSION)"

reno-lint:
@$(MAKE) run CMD="reno lint"
3 changes: 3 additions & 0 deletions build/gorelease.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ then
exit 1
fi

## Set default changelog file
CHANGELOG_FILE=${CHANGELOG_FILE:-./CHANGELOG_CURRENT.md}

RELEASE_NOTES=""
if [ -n "${CHANGELOG_FILE:-}" ]
then
Expand Down
13 changes: 8 additions & 5 deletions build/reno_report.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@ rst2md ./CHANGELOG.rst --output ./CHANGELOG.md
## It will be replaced by `unreleased_version_title` setting in the actual report file
UNRELEASED_VERSION=$(reno list 2>/dev/null | grep -E "^[0-9]+\.[0-9]+\.[0-9]+\-[0-9]+")

## Generate rst report
echo reno report --version=${UNRELEASED_VERSION} --output ./CHANGELOG_CURRENT.rst
reno report --version=${UNRELEASED_VERSION} --output ./CHANGELOG_CURRENT.rst
## Convert rst to markdown
rst2md ./CHANGELOG_CURRENT.rst --output ./CHANGELOG_CURRENT.md
if [ -n "${UNRELEASED_VERSION}" ]
then
## Generate rst report
echo reno report --version=${UNRELEASED_VERSION} --output ./CHANGELOG_CURRENT.rst
reno report --version=${UNRELEASED_VERSION} --output ./CHANGELOG_CURRENT.rst
## Convert rst to markdown
rst2md ./CHANGELOG_CURRENT.rst --output ./CHANGELOG_CURRENT.md
fi

0 comments on commit a05289f

Please sign in to comment.