diff options
| -rwxr-xr-x | .chglog/CHANGELOG.tpl.md | 12 | ||||
| -rwxr-xr-x | .chglog/config.yml | 27 | ||||
| -rw-r--r-- | justfile | 46 |
3 files changed, 67 insertions, 18 deletions
diff --git a/.chglog/CHANGELOG.tpl.md b/.chglog/CHANGELOG.tpl.md new file mode 100755 index 0000000..27f4fca --- /dev/null +++ b/.chglog/CHANGELOG.tpl.md @@ -0,0 +1,12 @@ +{{ if .Versions -}} +{{ range .Versions }} +## {{ .Tag.Name }} - {{ datetime "2006-01-02" .Tag.Date }} + +{{ range .CommitGroups -}} +### {{ .Title }} +{{ range .Commits -}} +- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }} +{{ end }} +{{ end -}} +{{ end -}} +{{ end -}} diff --git a/.chglog/config.yml b/.chglog/config.yml new file mode 100755 index 0000000..832eeb0 --- /dev/null +++ b/.chglog/config.yml @@ -0,0 +1,27 @@ +style: none +template: CHANGELOG.tpl.md +info: + title: CHANGELOG + repository_url: https://git.ofmax.li/unbound-ads +options: + commits: + # filters: + # Type: + # - feat + # - fix + # - perf + # - refactor + commit_groups: + # title_maps: + # feat: Features + # fix: Bug Fixes + # perf: Performance Improvements + # refactor: Code Refactoring + header: + pattern: "^(\\w*)\\:\\s(.*)$" + pattern_maps: + - Type + - Subject + notes: + keywords: + - BREAKING CHANGE @@ -11,15 +11,11 @@ TAGS := `git tag -l` default: @just --choose -docker-build: new-ver - #!/usr/bin/env bash - set -euxo pipefail +docker-build part="latest": (new-ver part) + #!/usr/bin/env bash + set -euxo pipefail new_ver=$(cat {{ NEW_VERSION }}); \ docker build --build-arg="version=$new_ver" -t unbound-ads:$new_ver . - - - - builddir: mkdir -p {{ BUILDDIR }}/etc @@ -31,6 +27,7 @@ clean: new-ver part="latest": builddir #!/usr/bin/env bash set -euxo pipefail + echo {{part}} echo "{{ TAGS }}" > {{ ALL_VERSIONS }} cat {{ ALL_VERSIONS }} | bumpver --last-version patch - > {{ CURRENT_VERSION }} if [[ {{part}} == "latest" ]]; @@ -42,10 +39,11 @@ new-ver part="latest": builddir fi git-push tag: - git push origin master - git push origin {{ tag }} + new_ver=$(cat {{ NEW_VERSION }}); \ + git push origin master; \ + git push origin {{ tag }} -git-tag-release: +git-build-release: #!/usr/bin/env bash set -euxo pipefail new_ver=$(cat {{ NEW_VERSION }}) @@ -59,11 +57,23 @@ git-tag-release: go tool cover -func={{ TEMPDIR }}/testcover.out >> {{ TEMPDIR }}/chglog # end temp tag git tag -d $new_ver - git tag --annotate --sign --cleanup=whitespace --file {{ TEMPDIR }}/chglog ${new_ver} +git-tag-release: + new_ver=$(cat {{ NEW_VERSION }}); \ + git tag --annotate --sign --cleanup=whitespace --file {{ TEMPDIR }}/chglog ${new_ver} -release part: test builddir (new-ver part) docker-build git-tag-release push +git-tag-clean: + #!/usr/bin/env bash + set -euxo pipefail + for tag in $(git tag -l "*-latest.*.*"); + do + git tag -d $tag; + done +# Release project, create new tags, build container, and push +release part: test builddir (docker-build part) git-build-release git-tag-release push + new_ver=$(cat {{ NEW_VERSION }}); \ + @echo "Version $new_ver has been released!" build version: test builddir CGO_ENABLED=0 go build -a -ldflags "-s -X 'main.Version={{version}}'" -o {{ BUILDDIR }}/bin/unbound-ads main.go @@ -74,16 +84,16 @@ push: @echo "pushed to all endpoints" docker-push registry="public.ecr.aws/s0f9o2k5": - #!/usr/bin/env bash - set -euxo pipefail + #!/usr/bin/env bash + set -euxo pipefail new_ver=$(cat {{ NEW_VERSION }}) docker tag unbound-ads:$new_ver {{registry}}/unbound-ads:$new_ver docker push {{registry}}/unbound-ads:$new_ver - if [[ $new_ver != *"latest"* ]]; - then + if [[ $new_ver != *"latest"* ]]; + then docker tag unbound-ads:$new_ver {{registry}}/unbound-ads:latest - docker push {{registry}}/unbound-ads:$new_ver - fi + docker push {{registry}}/unbound-ads:latest + fi run repo=(TEMPDIR): go run main.go |