Skip to content

Commit

Permalink
#33 - test doc generate action
Browse files Browse the repository at this point in the history
  • Loading branch information
apanasiuk-el committed Jul 23, 2024
1 parent c674fdb commit 88ca527
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 13 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/doc-generate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Generate commands documentation

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

permissions:
contents: write

jobs:
goreleaser:
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: |
# constants for selecting branches
readonly GIT_BRANCH="${GITHUB_REF_NAME}"
readonly GITHUB_ORG="${GITHUB_REPOSITORY_OWNER}"
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
echo "The new commands documentation was committed."
fi
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

0 comments on commit 88ca527

Please sign in to comment.