Skip to content

Commit

Permalink
chore: Add changelog generator
Browse files Browse the repository at this point in the history
Signed-off-by: Sergiy Kulanov <[email protected]>
  • Loading branch information
SergK authored and MykolaMarusenko committed Oct 27, 2024
1 parent 4519794 commit ca86aeb
Show file tree
Hide file tree
Showing 7 changed files with 265 additions and 0 deletions.
60 changes: 60 additions & 0 deletions .chglog/CHANGELOG.tpl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{{ if .Versions -}}
<a name="unreleased"></a>
## [Unreleased]

{{ if .Unreleased.CommitGroups -}}
{{ range .Unreleased.CommitGroups -}}
### {{ .Title }}

{{ range .Commits -}}
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
{{ end }}
{{ end -}}
{{ end -}}
{{ end -}}

{{ range .Versions }}
<a name="{{ .Tag.Name }}"></a>
## {{ if .Tag.Previous }}[{{ .Tag.Name }}]{{ else }}{{ .Tag.Name }}{{ end }} - {{ datetime "2006-01-02" .Tag.Date }}
{{ range .CommitGroups -}}
### {{ .Title }}

{{ range .Commits -}}
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
{{ end }}
{{ end -}}

{{- if .RevertCommits -}}
### Reverts

{{ range .RevertCommits -}}
- {{ .Revert.Header }}
{{ end }}
{{ end -}}

{{- if .MergeCommits -}}
### Pull Requests
{{ range .MergeCommits -}}
- {{ .Header }}
{{ end }}
{{ end -}}

{{- if .NoteGroups -}}
{{ range .NoteGroups -}}
### {{ .Title }}

{{ range .Notes }}
{{ .Body }}
{{ end }}
{{ end -}}
{{ end -}}
{{ end -}}

{{- if .Versions }}
[Unreleased]: {{ .Info.RepositoryURL }}/compare/{{ $latest := index .Versions 0 }}{{ $latest.Tag.Name }}...HEAD
{{ range .Versions -}}
{{ if .Tag.Previous -}}
[{{ .Tag.Name }}]: {{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}
{{ end -}}
{{ end -}}
{{ end -}}
50 changes: 50 additions & 0 deletions .chglog/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
style: none
template: CHANGELOG.tpl.md
info:
title: CHANGELOG
repository_url: https://github.com/KubeRocketCI/tekton-custom-task

options:
tag_filter_pattern: '^v'
sort: "semVer"

commits:
filters:
Type:
- chore
- docs
- feat
- fix
- refactor
- style
- test

commit_groups:
group_by: Type
sort_by: Custom
title_order:
- feat
- fix
- refactor
- style
- test
- chore
- docs
title_maps:
chore: Routine
docs: Documentation
feat: Features
fix: Bug Fixes
refactor: Code Refactoring
style: Formatting
test: Testing

header:
pattern: "^(feat|fix|docs|style|refactor|test|chore)+!?:\\s(.*)$"
pattern_maps:
- Type
- Subject

notes:
keywords:
- "BREAKING CHANGE:"
29 changes: 29 additions & 0 deletions .chglog/release.tpl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{{ range .Versions }}
<a name="{{ .Tag.Name }}"></a>
## {{ if .Tag.Previous }}[{{ .Tag.Name }}]{{ else }}{{ .Tag.Name }}{{ end }} - {{ datetime "2006-01-02" .Tag.Date }}
{{ range .CommitGroups -}}
### {{ .Title }}

{{ range .Commits -}}
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
{{ end }}
{{ end -}}

{{- if .NoteGroups -}}
{{ range .NoteGroups -}}
### {{ .Title }}

{{ range .Notes }}
{{ .Body }}
{{ end }}
{{ end -}}
{{ end -}}
{{ end -}}

{{- if .Versions }}
{{ range .Versions -}}
{{ if .Tag.Previous -}}
[{{ .Tag.Name }}]: {{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}
{{ end -}}
{{ end -}}
{{ end -}}
88 changes: 88 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Create EDP release
on:
push:
tags:
- 'v*'

env:
GOLANG_VERSION: '1.22'

jobs:
prepare-release:
name: Perform automatic release on trigger ${{ github.ref }}
runs-on: ubuntu-latest
env:
# The name of the tag as supplied by the GitHub event
SOURCE_TAG: ${{ github.ref }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: '0'

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GOLANG_VERSION }}

- name: Check if the published tag is well formed and setup vars
run: |
set -xue
# refs/tags/v2.10.7 -> v2.10.7
RELEASE_TAG="${SOURCE_TAG##*/}"
# install git-chglog
go install github.com/git-chglog/git-chglog/cmd/git-chglog@latest
# install crane
go install github.com/google/go-containerregistry/cmd/[email protected]
# install rekor-cli
go install github.com/sigstore/rekor/cmd/[email protected]
git-chglog --template .chglog/release.tpl.md -o release.md ${RELEASE_TAG}
# Extract image name and tag from RELEASE_TAG
IMAGE_NAME="epamedp/codebase-operator"
IMAGE_TAG=${RELEASE_TAG#v}
# Get the digest of the image
DIGEST=$(crane digest ${IMAGE_NAME}:${IMAGE_TAG} | tr ':' '-')
# Get the digest of the attestation layer
ATTESTATION_DIGEST=$(crane manifest ${IMAGE_NAME}:${DIGEST}.att | jq -r '.layers[].digest')
# Get the digest of the signature layer
SIGNATURE_DIGEST=$(crane manifest ${IMAGE_NAME}:${DIGEST}.sig | jq -r '.layers[].digest')
# Search for the UUID of the attestation in JSON format
ATTESTATION_UUID_JSON=$(rekor-cli search --sha ${ATTESTATION_DIGEST} --format json)
# Search for the UUID of the signature in JSON format
SIGNATURE_UUID_JSON=$(rekor-cli search --sha ${SIGNATURE_DIGEST} --format json)
# Parse the JSON output to get the UUIDs
ATTESTATION_UUID=$(echo ${ATTESTATION_UUID_JSON} | jq -r '.UUIDs[0]')
SIGNATURE_UUID=$(echo ${SIGNATURE_UUID_JSON} | jq -r '.UUIDs[0]')
# Create a new file with the desired text and the UUIDs
echo "### Deployment Certifications and Source Traceability" > new_release.md
echo "EDP container images bear [cosign](https://github.com/sigstore/cosign) signatures. Refer to the [documentation](https://epam.github.io/edp-install/operator-guide/artifacts-verification/) for instructions on verification." >> new_release.md
echo "The Rekor UUID's for this release is \`${ATTESTATION_UUID}\` - attestation and" >> new_release.md
echo "\`${SIGNATURE_UUID}\` - signature" >> new_release.md
# Append the contents of release.md to new_release.md
cat release.md >> new_release.md
# Move new_release.md to release.md
mv new_release.md release.md
echo "RELEASE_TAG=${RELEASE_TAG}" >> $GITHUB_ENV
- name: Create GitHub release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
id: create_release
with:
tag_name: ${{ env.RELEASE_TAG }}
release_name: ${{ env.RELEASE_TAG }}
body_path: release.md
30 changes: 30 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<a name="unreleased"></a>
## [Unreleased]

### Features

- Extend ApprovalTask with approval details
- Add ApprovalTask description support

### Bug Fixes

- Update dependencies and Makefile files

### Routine

- Update Chart.yaml documentation
- Add templates for github issues
- Update dependabot.yml
- Align version
- Update dependencies and add cache for packages

### Documentation

- Update documentation
- Update documentation


<a name="v0.0.1"></a>
## v0.0.1 - 2024-10-27

[Unreleased]: https://github.com/KubeRocketCI/tekton-custom-task/compare/v0.0.1...HEAD
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,14 @@ catalog-build: opm ## Build a catalog image.
catalog-push: ## Push a catalog image.
$(MAKE) docker-push IMG=$(CATALOG_IMG)

# use https://github.com/git-chglog/git-chglog/
.PHONY: changelog
changelog: git-chglog ## generate changelog
ifneq (${NEXT_RELEASE_TAG},)
$(GITCHGLOG) --next-tag v${NEXT_RELEASE_TAG} -o CHANGELOG.md v0.1.0..
else
$(GITCHGLOG) -o CHANGELOG.md build/0.1.0-SNAPSHOT.1..
endif

.PHONY: validate-docs
validate-docs: api-docs helm-docs ## Validate helm and api docs
Expand Down
Empty file added release.md
Empty file.

0 comments on commit ca86aeb

Please sign in to comment.