chore(release): automate release creation
This commit is contained in:
parent
e92265791e
commit
5f52ce6658
|
@ -0,0 +1,31 @@
|
|||
<a name="{{ (index .Versions 0).Tag.Name }}"></a>
|
||||
## {{ if (index .Versions 0).Tag.Previous }}[{{ (index .Versions 0).Tag.Name }}]{{ else }}{{ (index .Versions 0).Tag.Name }}{{ end }} - {{ datetime "2006-01-02" (index .Versions 0).Tag.Date }}
|
||||
{{ range (index .Versions 0).CommitGroups -}}
|
||||
### {{ .Title }}
|
||||
{{ range .Commits -}}
|
||||
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
|
||||
{{ end }}
|
||||
{{ end -}}
|
||||
|
||||
{{- if (index .Versions 0).RevertCommits -}}
|
||||
### Reverts
|
||||
{{ range (index .Versions 0).RevertCommits -}}
|
||||
- {{ .Revert.Header }}
|
||||
{{ end }}
|
||||
{{ end -}}
|
||||
|
||||
{{- if (index .Versions 0).MergeCommits -}}
|
||||
### Pull Requests
|
||||
{{ range (index .Versions 0).MergeCommits -}}
|
||||
- {{ .Header }}
|
||||
{{ end }}
|
||||
{{ end -}}
|
||||
|
||||
{{- if (index .Versions 0).NoteGroups -}}
|
||||
{{ range (index .Versions 0).NoteGroups -}}
|
||||
### {{ .Title }}
|
||||
{{ range .Notes }}
|
||||
{{ .Body }}
|
||||
{{ end }}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
|
@ -1,8 +0,0 @@
|
|||
.config-mapper.yml
|
||||
.config-mapper.yml.template
|
||||
.gitignore
|
||||
LICENSE
|
||||
README.md
|
||||
CHANGELOG.md
|
||||
.chglog
|
||||
build
|
14
Earthfile
14
Earthfile
|
@ -1,14 +0,0 @@
|
|||
VERSION 0.6
|
||||
|
||||
FROM golang:1.18-alpine3.15
|
||||
WORKDIR /config-mapper
|
||||
|
||||
build-macos:
|
||||
COPY . .
|
||||
RUN GOOS=darwin go build -o build/config-mapper main.go
|
||||
SAVE ARTIFACT build/config-mapper /config-mapper AS LOCAL build/x86-x64_darwin_config-mapper
|
||||
|
||||
build-linux:
|
||||
COPY . .
|
||||
RUN GOOS=linux go build -o build/config-mapper main.go
|
||||
SAVE ARTIFACT build/config-mapper /config-mapper AS LOCAL build/x86-x64_linux_config-mapper
|
|
@ -0,0 +1,67 @@
|
|||
#!/bin/bash
|
||||
|
||||
log() {
|
||||
NTR=$'\033[0m' # * Neutral
|
||||
INF=$'\033[0;34m' # * Blue (info)
|
||||
WRN=$'\033[1;33m' # * Yellow (warning)
|
||||
ERR=$'\033[1;31m' # * Red (error)
|
||||
|
||||
log_lvl=""
|
||||
case $1 in
|
||||
INFO)
|
||||
log_lvl="${INF}$1"
|
||||
;;
|
||||
WARNING)
|
||||
log_lvl="${WRN}$1"
|
||||
;;
|
||||
ERROR)
|
||||
log_lvl="${ERR}$1"
|
||||
;;
|
||||
esac
|
||||
|
||||
log_lvl="${log_lvl}${NTR}"
|
||||
msg="${log_lvl}\t$2"
|
||||
|
||||
echo -e "${msg}"
|
||||
}
|
||||
|
||||
log "INFO" "checking required dependencies to create release"
|
||||
if type git 1> /dev/null; then
|
||||
log "ERROR" "\"git\" binary not available"
|
||||
fi
|
||||
if type sd 1> /dev/null; then
|
||||
log "ERROR" "\"sd\" binary not available"
|
||||
fi
|
||||
if type gh 1> /dev/null; then
|
||||
log "ERROR" "\"gh\" binary not available"
|
||||
fi
|
||||
if type go 1> /dev/null; then
|
||||
log "ERROR" "\"go\" binary not available"
|
||||
fi
|
||||
if type git-chglog 1> /dev/null; then
|
||||
log "ERROR" "\"git-chglog\" binary not available"
|
||||
fi
|
||||
|
||||
read -p "Enter a release version (vX.Y.Z): " release
|
||||
|
||||
log "INFO" "updating release version in files"
|
||||
sd 'Version: "v0.3.0"' "Version: \"$release\"" cmd/cli.go
|
||||
|
||||
log "INFO" "updating changelog"
|
||||
git-chglog --next-tag $release --output CHANGELOG.md
|
||||
|
||||
log "INFO" "commit & push changes"
|
||||
git add .
|
||||
git commit -m "$release"
|
||||
git push
|
||||
git tag -a $release -m $release
|
||||
git push --tags
|
||||
|
||||
log "INFO" "building Linux binary"
|
||||
GOOS=linux go build -o build/x86-x64_linux_config-mapper
|
||||
|
||||
log "INFO" "building Darwin binary"
|
||||
GOOS=darwin go build -o build/x86-x64_darwin_config-mapper
|
||||
|
||||
log "INFO" "creating release"
|
||||
gh release create $release -n $(git-chglog -t .chglog/RELEASE_CHANGELOG.tpl.md) build/x86-x64_
|
Reference in New Issue