Skip to content

Commit

Permalink
fix: release-please and pipeline templates (#158)
Browse files Browse the repository at this point in the history
  • Loading branch information
LucaLanziani authored Nov 30, 2023
1 parent 5881147 commit d53d290
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release-please.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
run: go run main.go build
env:
INITIUM_APP_NAME: initium-cli
INITIUM_VERSION: ${{ steps.release.outputs.release_tag_name }}
INITIUM_VERSION: ${{ steps.release.outputs.tag_name }}
INITIUM_REGISTRY_USER: ${{ github.actor }}
INITIUM_REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
if: ${{ steps.release.outputs.release_created }}
Expand All @@ -43,7 +43,7 @@ jobs:
run: go run main.go push
env:
INITIUM_APP_NAME: initium-cli
INITIUM_VERSION: ${{ steps.release.outputs.release_tag_name }}
INITIUM_VERSION: ${{ steps.release.outputs.tag_name }}
INITIUM_REGISTRY_USER: ${{ github.actor }}
INITIUM_REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
if: ${{ steps.release.outputs.release_created }}
Expand Down
4 changes: 2 additions & 2 deletions assets/github/onbranch.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
ref: {{ `${{ github.head_ref }}` }}

- name: build and deploy application
uses: docker://ghcr.io/nearform/initium-cli:latest
uses: docker://ghcr.io/nearform/initium-cli:{{ .Version }}
with:
args: onbranch
env:
Expand All @@ -41,7 +41,7 @@ jobs:
- uses: actions/checkout@v3

- name: delete application
uses: docker://ghcr.io/nearform/initium-cli:latest
uses: docker://ghcr.io/nearform/initium-cli:{{ .Version }}
with:
args: onbranch --clean --branch-name {{ `${{ github.head_ref }}` }}
env:
Expand Down
2 changes: 1 addition & 1 deletion assets/github/onmain.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- uses: actions/checkout@v3

- name: build and deploy on {{ .DefaultBranch }}
uses: docker://ghcr.io/nearform/initium-cli:latest
uses: docker://ghcr.io/nearform/initium-cli:{{ .Version }}
with:
args: onmain
env:
Expand Down
8 changes: 8 additions & 0 deletions src/cli/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,19 @@ func (c icli) InitGithubCMD(cCtx *cli.Context) error {
logger := log.New(os.Stderr)
logger.SetLevel(log.DebugLevel)

version := "v" + c.release.Version // Go releaser strips the v, we want it back for containers

if c.release.Version == "dev" {
version = "latest"
}

options := project.InitOptions{
PipelineType: cCtx.Command.Name,
DestinationFolder: cCtx.String(destinationFolderFlag),
DefaultBranch: cCtx.String(defaultBranchFlag),
Version: version,
}

data, err := project.ProjectInit(options, c.Resources)

if err != nil {
Expand Down
1 change: 1 addition & 0 deletions src/services/project/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ type InitOptions struct {
DestinationFolder string
DefaultBranch string
PipelineType string
Version string
}

func GuessAppName() *string {
Expand Down

0 comments on commit d53d290

Please sign in to comment.