Skip to content

Commit

Permalink
Merge pull request #2470 from embano1/issue-2467
Browse files Browse the repository at this point in the history
  • Loading branch information
embano1 committed May 28, 2021
2 parents df9dfde + 6f2597b commit 5395233
Show file tree
Hide file tree
Showing 9 changed files with 296 additions and 53 deletions.
13 changes: 8 additions & 5 deletions .chglog/CHANGELOG.tpl.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,18 @@
{{ end }}
{{ end -}}

{{- if .NoteGroups -}}
{{ range .NoteGroups -}}
### ⚠️ {{ .Title }}
### ⚠️ BREAKING

{{ range .Notes }}
{{ .Body }}
{{ range .Commits -}}
{{ if .Notes -}}
{{ if not .Merge -}}
{{ if not (contains .Header "Update CHANGELOG for" ) -}}
{{ range .Notes }}{{ .Body }}
{{ end }}
{{ end -}}
{{ end -}}
{{ end -}}
{{ end -}}

### 📖 Commits

Expand Down
46 changes: 46 additions & 0 deletions .chglog/RELEASE.tpl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{{ range .Versions }}
<a name="{{ .Tag.Name }}"></a>
## {{ if .Tag.Previous }}[Release {{ .Tag.Name }}]({{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}){{ else }}{{ .Tag.Name }}{{ end }}

> Release Date: {{ datetime "2006-01-02" .Tag.Date }}
{{ range .CommitGroups -}}
### {{ .Title }}

{{ range .Commits -}}
- [{{ .Hash.Short }}]{{"\t"}}{{ .Subject }}{{ range .Refs }} (#{{ .Ref }}) {{ end }}
{{ end }}
{{ end -}}

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

{{ range .RevertCommits -}}
- [{{ .Hash.Short }}]{{"\t"}}{{ .Revert.Header }}{{ range .Refs }} (#{{ .Ref }}) {{ end }}
{{ end }}
{{ end -}}

### ⚠️ BREAKING

{{ range .Commits -}}
{{ if .Notes -}}
{{ if not .Merge -}}
{{ if not (contains .Header "Update CHANGELOG for" ) -}}
{{ range .Notes }}{{ .Body }}
{{ end }}
{{ end -}}
{{ end -}}
{{ end -}}
{{ end -}}

### 📖 Commits

{{ range .Commits -}}
{{ if not .Merge -}}
{{ if not (contains .Header "Update CHANGELOG for" ) -}}
- [{{ .Hash.Short }}]{{"\t"}}{{ .Header }}{{ range .Refs }} (#{{ .Ref }}) {{ end }}
{{ end -}}
{{ end -}}
{{ end -}}

{{ end -}}
10 changes: 9 additions & 1 deletion .chglog/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
style: github
template: CHANGELOG.tpl.md
# by default use Github RELEASE template which includes refs to issues/PRs
# to generate CHANGELOG.md use git-chlog -t <path_to_CHANGELOG.tpl.md>
template: RELEASE.tpl.md
info:
title: CHANGELOG
repository_url: https://github.com/vmware/govmomi
Expand All @@ -10,11 +12,17 @@ options:
- govc
- vcsim
- chore
- docs
- examples
- fix
commit_groups:
title_maps:
govc: 💫 `govc` (CLI)
vcsim: 💫 `vcsim` (Simulator)
chore: 🧹 Chore
fix: 🐞 Fix
docs: 📃 Documentation
examples: 💡 Examples
header:
pattern: "^(\\w*)\\:\\s(.*)$"
pattern_maps:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/govmomi-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ on:
# also run every night
schedule:
- cron: "0 1 * * *"

workflow_dispatch:

jobs:
artifacts:
Expand Down
47 changes: 39 additions & 8 deletions .github/workflows/govmomi-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ on:
push:
tags:
- "v*" # Push events to matching v*, i.e. v0.25.0, v1.15.1
workflow_dispatch:

jobs:
artifacts:
release:
name: Create Release
runs-on: ubuntu-latest
timeout-minutes: 60
Expand All @@ -34,12 +35,7 @@ jobs:
with:
fetch-depth: 0 # for CHANGELOG

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16

- name: Create CHANGELOG
- name: Create RELEASE CHANGELOG
env:
IMAGE: quay.io/git-chglog/git-chglog
# https://quay.io/repository/git-chglog/git-chglog from tag v0.14.2
Expand All @@ -48,10 +44,45 @@ jobs:
# generate CHANGELOG for this Github release tag only
docker run --rm -v $PWD:/workdir ${IMAGE}@sha256:${IMAGE_SHA} -o RELEASE_CHANGELOG.md $(basename "${{ github.ref }}" )
- name: Build and push Artifacts
- name: Create Release and build/push Artifacts
uses: goreleaser/goreleaser-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
version: latest
args: release --rm-dist --release-notes RELEASE_CHANGELOG.md # will push artefacts and container images

pull-request:
needs: release
name: Create CHANGELOG.md PR
runs-on: ubuntu-latest
continue-on-error: true # errors caused by this job won't stop workflow

steps:
- name: Checkout
uses: actions/checkout@v2
with:
# for changelog
fetch-depth: 0
ref: "master"

- name: Create CHANGELOG.md commit
env:
IMAGE: quay.io/git-chglog/git-chglog
# https://quay.io/repository/git-chglog/git-chglog from tag v0.14.2
IMAGE_SHA: 998e89dab8dd8284cfff5f8cfb9e9af41fe3fcd4671f2e86a180e453c20959e3
run: |
# generate CHANGELOG for this Github release tag only
docker run --rm -v $PWD:/workdir ${IMAGE}@sha256:${IMAGE_SHA} -o CHANGELOG.md -t .chglog/CHANGELOG.tpl.md v0.1.0..$(basename "${{ github.ref }}" )
git config user.email "${{ github.actor }}@users.noreply.github.com"
git config user.name "${{ github.actor }}"
git add CHANGELOG.md
git commit -m "Update CHANGELOG for $(basename ${{ github.ref }})"
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
delete-branch: true
title: "Update CHANGELOG"
body: |
Update CHANGELOG.md for new release
1 change: 1 addition & 0 deletions .github/workflows/verify-docker-login.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ name: Verify Docker Login
on:
schedule:
- cron: "0 1 * * *" # daily
workflow_dispatch:

jobs:
login:
Expand Down
Loading

0 comments on commit 5395233

Please sign in to comment.