diff --git a/.github/workflows/docs-publish.yaml b/.github/workflows/docs-publish.yaml
index 2e2e7f5..61a7475 100644
--- a/.github/workflows/docs-publish.yaml
+++ b/.github/workflows/docs-publish.yaml
@@ -8,8 +8,6 @@ on:
- feature/*
- release/*
- hotfix/*
- tags:
- - 'v[0-9]+.[0-9]+.[0-9]+'
jobs:
docs-publish:
@@ -26,16 +24,34 @@ jobs:
- name: Build, validate documentation using MkDocs
run: |
- mkdocs build --verbose --clean --strict
+ mkdocs build --clean --strict
rm -r site/
- - name: Build, publish, version documentation using Mike (only for stable tags)
- if: startsWith(github.ref, 'refs/tags/')
+ - name: Build, publish, version documentation using Mike (only for master)
+ if: github.ref == 'refs/heads/master'
run: |
+ # constants for selecting branches
+ readonly GITHUB_ORG="${GITHUB_REPOSITORY_OWNER}"
+
+ function resolve_release_envs() {
+ echo "Git commit message:"
+ GIT_COMMIT_MSG="$(git log -1 --pretty=format:"%s")"
+ echo "${GIT_COMMIT_MSG}"
+
+ if [[ ! "${GIT_COMMIT_MSG}" =~ ^Merge\ pull\ request\ #[0-9]+\ from\ ${GITHUB_ORG}/(hotfix|release)/(v[0-9]+\.[0-9]+\.[0-9]+)$ ]]; then
+ >&2 echo "Pushes to master should be done via merges of PR requests from hotfix/vN.N.N or release/vN.N.N branches only."
+ >&2 echo "The expected message format (will be used for parsing a release tag):"
+ >&2 echo "Merge pull request #N from ${GITHUB_ORG}/hotfix/vN.N.N or ${GITHUB_ORG}/release/vN.N.N."
+ exit 1
+ fi
+
+ VERSION="${BASH_REMATCH[2]}"
+ }
+
echo "Configure Git user.name and user.email."
git config user.name github-actions
git config user.email github-actions@github.com
- VERSION=${GITHUB_REF#refs/tags/}
-
+ echo "Publish documentation"
+ resolve_release_envs
mike deploy --update-aliases --push --rebase "${VERSION}" latest
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 9094d5d..b83572f 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -41,7 +41,7 @@ jobs:
readonly GIT_BRANCH="${GITHUB_REF_NAME}"
readonly GITHUB_ORG="${GITHUB_REPOSITORY_OWNER}"
- function release() {
+ function resolve_release_envs() {
echo "Git commit message:"
GIT_COMMIT_MSG="$(git log -1 --pretty=format:"%s")"
echo "${GIT_COMMIT_MSG}"
@@ -69,7 +69,7 @@ jobs:
fi
;;
master)
- release
+ resolve_release_envs
;;
esac
diff --git a/docs/commands.md b/docs/commands.md
index ae828f9..f448e77 100644
--- a/docs/commands.md
+++ b/docs/commands.md
@@ -17,9 +17,9 @@ rmk
Command line tool for reduced management of the provision of Kubernetes clusters in different environments and management of service releases.
-**BuiltBy:** goreleaser \
-**Commit:** 25e5886 \
-**Date:** 2024-09-03T15:03:12Z \
+**BuiltBy:** goreleaser
+**Commit:** 0370089
+**Date:** 2024-09-03T16:41:40Z
**Target:** linux_amd64
**Usage**:
diff --git a/main.go b/main.go
index 43b93f6..c87d279 100644
--- a/main.go
+++ b/main.go
@@ -58,9 +58,9 @@ GLOBAL OPTIONS:
Command line tool for reduced management of the provision of Kubernetes clusters in different environments and management of service releases.
-**BuiltBy:** ` + builtBy + ` \
-**Commit:** ` + commit + ` \
-**Date:** ` + date + ` \
+**BuiltBy:** ` + builtBy + `
+**Commit:** ` + commit + `
+**Date:** ` + date + `
**Target:** ` + target + `
{{ end }}
**Usage**: