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

fix: release-please and pipeline templates #158

Merged
merged 1 commit into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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