-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set up .changelog, release-notes (#2)
- Loading branch information
Showing
7 changed files
with
193 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
```release-note:enhancement | ||
Set up CHANGELOG && .changelog | ||
``` | ||
|
||
```release-note:enhancement | ||
Set up release-notes generation on CI | ||
``` | ||
|
||
```release-note:enhancement | ||
Tag docker image on docker GHA | ||
``` | ||
|
||
```release-note:enhancement | ||
Add Makefile | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
{{- if index .NotesByType "breaking-change" -}} | ||
BREAKING CHANGES: | ||
|
||
{{range index .NotesByType "breaking-change" -}} | ||
* {{ template "note" . }} | ||
{{ end -}} | ||
{{- end -}} | ||
|
||
{{- if .NotesByType.security }} | ||
SECURITY: | ||
|
||
{{range .NotesByType.security -}} | ||
* {{ template "note" . }} | ||
{{ end -}} | ||
{{- end -}} | ||
|
||
{{- if .NotesByType.feature }} | ||
FEATURES: | ||
|
||
{{range .NotesByType.feature -}} | ||
* {{ template "note" . }} | ||
{{ end -}} | ||
{{- end -}} | ||
|
||
{{- if .NotesByType.enhancement }} | ||
ENHANCEMENT: | ||
|
||
{{range .NotesByType.enhancement -}} | ||
* {{ template "note" . }} | ||
{{ end -}} | ||
{{- end -}} | ||
|
||
{{- if .NotesByType.deprecation }} | ||
DEPRECATIONS: | ||
|
||
{{range .NotesByType.deprecation -}} | ||
* {{ template "note" . }} | ||
{{ end -}} | ||
{{- end -}} | ||
|
||
{{- if .NotesByType.bug }} | ||
BUG FIXES: | ||
|
||
{{range .NotesByType.bug -}} | ||
* {{ template "note" . }} | ||
{{ end -}} | ||
{{- end -}} | ||
|
||
{{- if .NotesByType.doc }} | ||
DOCS: | ||
|
||
{{range .NotesByType.doc -}} | ||
* {{ template "note" . }} | ||
{{ end -}} | ||
{{- end -}} | ||
|
||
{{- if .NotesByType.dependency }} | ||
DEPENDENCIES: | ||
|
||
{{range .NotesByType.dependency -}} | ||
* {{ template "note" . }} | ||
{{ end -}} | ||
{{- end -}} | ||
|
||
{{- if .NotesByType.note }} | ||
NOTES: | ||
|
||
{{range .NotesByType.note -}} | ||
* {{ template "note" . }} | ||
{{ end -}} | ||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{{- define "note" -}} | ||
{{.Body}}{{if not (stringHasPrefix .Issue "_")}} [[GH-{{- .Issue -}}](https://github.com/danroux/sk8l-ui/issues/{{- .Issue -}})]{{end}} | ||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# This workflow checks that there is either a 'pr/no-changelog' label applied to a PR | ||
# or there is a .changelog/<pr number>.txt file associated with a PR for a changelog entry | ||
name: Changelog Entry | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, labeled] | ||
# Runs on PRs to main and all release branches | ||
branches: | ||
- main | ||
|
||
jobs: | ||
# checks that a .changelog entry is present for a PR | ||
changelog-check: | ||
# If there a `pr/no-changelog` label we ignore this check | ||
if: "!contains(github.event.pull_request.labels.*.name, 'pr/no-changelog') || github.event.pull_request.user.login == 'dependabot'" | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
fetch-depth: 0 # by default the checkout action doesn't checkout all branches | ||
- name: Check for changelog entry in diff | ||
run: | | ||
# check if there is a diff in the .changelog directory | ||
changelog_files=$(git --no-pager diff --name-only HEAD "$(git merge-base HEAD "origin/${{ github.event.pull_request.base.ref }}")" -- .changelog/${{ github.event.pull_request.number }}.txt) | ||
# If we do not find a file in .changelog/, we fail the check | ||
if [ -z "$changelog_files" ]; then | ||
# Fail status check when no .changelog entry was found on the PR | ||
echo "Did not find a .changelog entry and the 'pr/no-changelog' label was not applied." | ||
exit 1 | ||
else | ||
echo "Found .changelog entry in PR!" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v[0-9]+.[0-9]+.[0-9]+*' | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
release-notes: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
with: | ||
fetch-depth: 0 | ||
- name: Generate Release Notes | ||
run: sed -n -e "1{/# /d;}" -e "2{/^$/d;}" -e "/# $(git describe --abbrev=0 --exclude="$(git describe --abbrev=0 --match='v*.*.*' --tags)" --match='v*.*.*' --tags | tr -d v)/q;p" CHANGELOG.md > release-notes.txt | ||
- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 | ||
with: | ||
name: release-notes | ||
path: release-notes.txt | ||
retention-days: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# https://gist.github.com/mpneuried/0594963ad38e68917ef189b4e6a269db | ||
|
||
# HELP | ||
# This will output the help for each task | ||
# thanks to https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html | ||
.PHONY: help | ||
|
||
help: ## This help. | ||
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) | ||
|
||
# Bump these on release | ||
VERSION_MAJOR ?= 0 | ||
VERSION_MINOR ?= 4 | ||
VERSION_PATCH ?= 0 | ||
|
||
WITHOUT ?= $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH) | ||
VERSION ?= v$(WITHOUT) | ||
|
||
version: | ||
@echo $(VERSION) | ||
|
||
# For changelog generation, default the last release to the last tag on | ||
# any branch, and this release to just be the current branch we're on. | ||
LAST_RELEASE?=$$(git describe --tags $$(git rev-list --tags --max-count=1)) | ||
THIS_RELEASE?=$$(git rev-parse --abbrev-ref HEAD) | ||
|
||
# expected to be invoked by make changelog LAST_RELEASE=gitref THIS_RELEASE=gitref | ||
changelog: | ||
@echo "Generating changelog for $(THIS_RELEASE) from $(LAST_RELEASE)..." | ||
@echo | ||
@changelog-build -last-release $(LAST_RELEASE) \ | ||
-entries-dir .changelog/ \ | ||
-changelog-template .changelog/changelog.tmpl \ | ||
-note-template .changelog/note.tmpl \ | ||
-this-release $(THIS_RELEASE) | ||
|
||
changelog-entry: | ||
@changelog-entry -dir .changelog/ | ||
|
||
.PHONY: version changelog changelog-entry |