Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/rmk 33 implement a new GitHub action for rmk doc generate #35

Merged
45 changes: 45 additions & 0 deletions .github/workflows/docs-commands-generate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Generate commands documentation

on:
push:
branches:
- develop
- hotfix/*

permissions:
contents: write

jobs:
docs-commands-generate:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.21

- name: Run GoReleaser artifact build
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: v1.23.0
args: build --clean --skip=validate

- name: Generate and commit new commands documentation
run: |
echo "Configure Git user.name and user.email."
git config user.name github-actions
git config user.email [email protected]

echo "Generate new commands documentation."
./dist/rmk_linux_amd64_v1/rmk doc generate > ./docs/commands.md

if (git commit --all --message="Update commands documentation"); then
git push
echo "The new commands documentation has been committed."
fi
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ jobs:
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}/release/(v[0-9]+\.[0-9]+\.[0-9]+)$ ]]; then
>&2 echo "Pushes to master should be done via merges of PR requests from release/vN.N.N branches only."
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 edenlabllc/release/vN.N.N"
>&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[1]}"
VERSION="${BASH_REMATCH[2]}"
echo "DISABLE_BLOB_RMK_RC=true" >> "${GITHUB_ENV}"
}

Expand Down
2 changes: 1 addition & 1 deletion commands/container_registry_category.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (cr *CRCommands) dockerLogin() error {
}

if token, ok := credentials[cr.Conf.AWSECRUserName]; !ok {
return fmt.Errorf("failed to get token")
return fmt.Errorf("failed to get ECR token")
} else {
if cr.Ctx.Bool("get-token") {
fmt.Println(token)
Expand Down
10 changes: 5 additions & 5 deletions commands/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,11 @@ func flagsConfigList() []cli.Flag {
func flagsClusterK3DCreate() []cli.Flag {
return append(flagsHidden(),
&cli.StringFlag{
Name: "k3d-volume-host-path",
Usage: "host local directory path for mount into K3D cluster",
Aliases: []string{"kv"},
EnvVars: []string{"RMK_K3D_VOLUME_HOST_PATH"},
Value: system.GetPwdPath(""),
Name: "k3d-volume-host-path",
Usage: "host local directory path for mount into K3D cluster",
Aliases: []string{"kv"},
EnvVars: []string{"RMK_K3D_VOLUME_HOST_PATH"},
DefaultText: "present working directory",
},
)
}
Expand Down
20 changes: 13 additions & 7 deletions commands/k3d_category.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,21 @@ func (k *K3DCommands) prepareK3D(args ...string) error {
return err
}

for key, val := range credentials {
k.SpecCMD.Envs = append(k.SpecCMD.Envs,
"K3D_NAME="+k.Conf.Name,
"K3D_VOLUME_HOST_PATH="+k.Ctx.String("k3d-volume-host-path"),
"K3D_AWS_ECR_USER="+key,
"K3D_AWS_ECR_PASSWORD="+val,
)
k.SpecCMD.Envs = append(k.SpecCMD.Envs, "K3D_NAME="+k.Conf.Name)

if token, ok := credentials[k.Conf.AWSECRUserName]; !ok {
return fmt.Errorf("failed to get ECR token")
} else {
k.SpecCMD.Envs = append(k.SpecCMD.Envs, "K3D_AWS_ECR_USER="+k.Conf.AWSECRUserName, "K3D_AWS_ECR_PASSWORD="+token)
}

if len(k.Ctx.String("k3d-volume-host-path")) > 0 {
k.SpecCMD.Envs = append(k.SpecCMD.Envs, "K3D_VOLUME_HOST_PATH="+k.Ctx.String("k3d-volume-host-path"))
return nil
}

k.SpecCMD.Envs = append(k.SpecCMD.Envs, "K3D_VOLUME_HOST_PATH="+system.GetPwdPath(""))

return nil
}

Expand Down
4 changes: 1 addition & 3 deletions docs/release-notes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
- #18 - Fixed links to the OSS repository in project generation.
- #18 - Split the issue template into the bug and feature templates.
- #18 - Updated the Roadmap section of README.md.
- #33 - Added a new GitHub action for RMK commands documentation generation.