mirror of
https://github.com/bpg/terraform-provider-proxmox.git
synced 2025-06-29 18:21:10 +00:00
try different way to generate a changelog
This commit is contained in:
parent
2605d59bdd
commit
1c589dab7b
55
.github/workflows/generate_changelog.yml
vendored
55
.github/workflows/generate_changelog.yml
vendored
@ -1,28 +1,45 @@
|
||||
name: Generate CHANGELOG
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
# types: [closed]
|
||||
workflow_dispatch:
|
||||
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
issues:
|
||||
types: [closed, edited]
|
||||
|
||||
jobs:
|
||||
GenerateChangelog:
|
||||
# if: github.event.pull_request.merged || github.event_name == 'workflow_dispatch'
|
||||
generate_changelog:
|
||||
runs-on: ubuntu-latest
|
||||
name: Generate changelog for master branch
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Generate changelog
|
||||
uses: charmixer/auto-changelog-action@v1
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- run: cd tools && go install github.com/hashicorp/go-changelog/cmd/changelog-build
|
||||
- run: ./scripts/generate-changelog.sh
|
||||
- run: |
|
||||
if [[ `git status --porcelain` ]]; then
|
||||
if ${{github.event_name == 'workflow_dispatch'}}; then
|
||||
MSG="Update CHANGELOG.md (Manual Trigger)"
|
||||
else
|
||||
MSG="Update CHANGELOG.md for #${{ github.event.pull_request.number }}"
|
||||
fi
|
||||
git config --local user.email changelogbot@hashicorp.com
|
||||
git config --local user.name changelogbot
|
||||
git add CHANGELOG.md
|
||||
git commit -m "$MSG"
|
||||
git push
|
||||
fi
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
# - name: Commit files
|
||||
# env:
|
||||
# CI_USER: ${{ secrets.YOUR_GITHUB_USER }}
|
||||
# CI_EMAIL: ${{ secrets.YOUR_GITHUB_EMAIL }}
|
||||
# run: |
|
||||
# git config --local user.email "$CI_EMAIL"
|
||||
# git config --local user.name "$CI_USER"
|
||||
# git add CHANGELOG.md && git commit -m 'Updated CHANGELOG.md' && echo "push=true" >> $GITHUB_ENV || echo "No changes to CHANGELOG.md"
|
||||
|
||||
# - name: Push changes
|
||||
# if: env.push == 'true'
|
||||
# env:
|
||||
# CI_USER: ${{ secrets.YOUR_GITHUB_USER }}
|
||||
# CI_TOKEN: ${{ secrets.YOUR_GITHUB_TOKEN or GITHUB_TOKEN }}
|
||||
# run: |
|
||||
# git push "https://$CI_USER:$CI_TOKEN@github.com/$GITHUB_REPOSITORY.git" HEAD:master
|
||||
|
||||
- uses: stefanzweifel/git-auto-commit-action@v4
|
||||
with:
|
||||
commit_message: Update Changelog for PR
|
||||
file_pattern: CHANGELOG.md
|
||||
|
@ -1,31 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This script rewrites [GH-nnnn]-style references in the CHANGELOG.md file to
|
||||
# be Markdown links to the given github issues.
|
||||
#
|
||||
# This is run during releases so that the issue references in all of the
|
||||
# released items are presented as clickable links, but we can just use the
|
||||
# easy [GH-nnnn] shorthand for quickly adding items to the "Unrelease" section
|
||||
# while merging things between releases.
|
||||
|
||||
set -e
|
||||
|
||||
if [[ ! -f CHANGELOG.md ]]; then
|
||||
echo "ERROR: CHANGELOG.md not found in pwd."
|
||||
echo "Please run this from the root of the terraform provider repository"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ `uname` == "Darwin" ]]; then
|
||||
echo "Using BSD sed"
|
||||
SED="sed -i.bak -E -e"
|
||||
else
|
||||
echo "Using GNU sed"
|
||||
SED="sed -i.bak -r -e"
|
||||
fi
|
||||
|
||||
PROVIDER_URL="https:\/\/github.com\/hashicorp\/terraform-provider-aws\/issues"
|
||||
|
||||
$SED "s/GH-([0-9]+)/\[#\1\]\($PROVIDER_URL\/\1\)/g" -e 's/\[\[#(.+)([0-9])\)]$/(\[#\1\2))/g' CHANGELOG.md
|
||||
|
||||
rm CHANGELOG.md.bak
|
@ -1,41 +0,0 @@
|
||||
|
||||
{{- if index .NotesByType "breaking-change" }}
|
||||
BREAKING CHANGES:
|
||||
|
||||
{{range index .NotesByType "breaking-change" -}}
|
||||
{{ template "note" .}}
|
||||
{{ end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if .NotesByType.note }}
|
||||
NOTES:
|
||||
|
||||
{{range .NotesByType.note -}}
|
||||
{{ template "note" .}}
|
||||
{{ end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $features := combineTypes .NotesByType.feature (index .NotesByType "new-resource" ) (index .NotesByType "new-data-source") (index .NotesByType "new-guide") }}
|
||||
{{- if $features }}
|
||||
FEATURES:
|
||||
|
||||
{{range $features | sort -}}
|
||||
{{ template "note" . }}
|
||||
{{ end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if .NotesByType.enhancement }}
|
||||
ENHANCEMENTS:
|
||||
|
||||
{{range .NotesByType.enhancement | sort -}}
|
||||
{{ template "note" .}}
|
||||
{{ end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if .NotesByType.bug }}
|
||||
BUG FIXES:
|
||||
|
||||
{{range .NotesByType.bug | sort -}}
|
||||
{{ template "note" . }}
|
||||
{{ end -}}
|
||||
{{- end -}}
|
@ -1,54 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
|
||||
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
__parent="$(dirname "$__dir")"
|
||||
|
||||
CHANGELOG_FILE_NAME="CHANGELOG.md"
|
||||
CHANGELOG_TMP_FILE_NAME="CHANGELOG.tmp"
|
||||
TARGET_SHA=$(git rev-parse HEAD)
|
||||
PREVIOUS_RELEASE_TAG=$(git describe --abbrev=0 --match='v*.*.*' --tags)
|
||||
PREVIOUS_RELEASE_SHA=$(git rev-list -n 1 $PREVIOUS_RELEASE_TAG)
|
||||
|
||||
if [ $TARGET_SHA == $PREVIOUS_RELEASE_SHA ]; then
|
||||
echo "Nothing to do"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
PREVIOUS_CHANGELOG=$(sed -n -e "/# ${PREVIOUS_RELEASE_TAG#v}/,\$p" $__parent/$CHANGELOG_FILE_NAME)
|
||||
|
||||
if [ -z "$PREVIOUS_CHANGELOG" ]
|
||||
then
|
||||
echo "Unable to locate previous changelog contents."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CHANGELOG=$($(go env GOPATH)/bin/changelog-build -this-release $TARGET_SHA \
|
||||
-last-release $PREVIOUS_RELEASE_SHA \
|
||||
-git-dir $__parent \
|
||||
-entries-dir .changelog \
|
||||
-changelog-template $__dir/changelog.tmpl \
|
||||
-note-template $__dir/release-note.tmpl \
|
||||
-storage-mode filesystem)
|
||||
if [ -z "$CHANGELOG" ]
|
||||
then
|
||||
echo "No changelog generated."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
rm -f $CHANGELOG_TMP_FILE_NAME
|
||||
|
||||
sed -n -e "1{/# /p;}" $__parent/$CHANGELOG_FILE_NAME > $CHANGELOG_TMP_FILE_NAME
|
||||
echo "$CHANGELOG" >> $CHANGELOG_TMP_FILE_NAME
|
||||
echo >> $CHANGELOG_TMP_FILE_NAME
|
||||
echo "$PREVIOUS_CHANGELOG" >> $CHANGELOG_TMP_FILE_NAME
|
||||
|
||||
cp $CHANGELOG_TMP_FILE_NAME $CHANGELOG_FILE_NAME
|
||||
|
||||
rm $CHANGELOG_TMP_FILE_NAME
|
||||
|
||||
echo "Successfully generated changelog."
|
||||
|
||||
exit 0
|
13
tools/go.mod
13
tools/go.mod
@ -1,13 +0,0 @@
|
||||
module github.com/bpg/terraform-provider-proxmox/tools
|
||||
|
||||
go 1.16
|
||||
|
||||
require (
|
||||
github.com/bflad/tfproviderdocs v0.9.1
|
||||
github.com/client9/misspell v0.3.4
|
||||
github.com/golangci/golangci-lint v1.42.1
|
||||
github.com/hashicorp/go-changelog v0.0.0-20201005170154-56335215ce3a
|
||||
github.com/katbyte/terrafmt v0.3.0
|
||||
github.com/pavius/impi v0.0.3
|
||||
github.com/terraform-linters/tflint v0.30.0
|
||||
)
|
1527
tools/go.sum
1527
tools/go.sum
File diff suppressed because it is too large
Load Diff
@ -1,13 +0,0 @@
|
||||
// +build tools
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
_ "github.com/bflad/tfproviderdocs"
|
||||
_ "github.com/client9/misspell/cmd/misspell"
|
||||
_ "github.com/golangci/golangci-lint/cmd/golangci-lint"
|
||||
_ "github.com/hashicorp/go-changelog/cmd/changelog-build"
|
||||
_ "github.com/katbyte/terrafmt"
|
||||
_ "github.com/pavius/impi/cmd/impi"
|
||||
_ "github.com/terraform-linters/tflint"
|
||||
)
|
Loading…
Reference in New Issue
Block a user