diff --git a/.github/workflows/release-please.yaml b/.github/workflows/release-please.yaml new file mode 100644 index 0000000..f7dd5af --- /dev/null +++ b/.github/workflows/release-please.yaml @@ -0,0 +1,19 @@ +on: + push: + branches: + - main + +permissions: + contents: write + pull-requests: write + +name: release-please + +jobs: + release-please: + runs-on: ubuntu-latest + steps: + - uses: google-github-actions/release-please-action@v3 + with: + release-type: go + package-name: release-please-action \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..738ea47 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,35 @@ +name: goreleaser + +on: + push: + # run only against tags + tags: + - '*' + +permissions: + contents: write + # packages: write + # issues: write + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - run: git fetch --force --tags + + - uses: actions/setup-go@v4 + with: + go-version: stable + + - uses: goreleaser/goreleaser-action@v4 + with: + # either 'goreleaser' (default) or 'goreleaser-pro': + distribution: goreleaser + version: latest + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml deleted file mode 100644 index d33ab96..0000000 --- a/.github/workflows/tests.yaml +++ /dev/null @@ -1,19 +0,0 @@ -name: Tests - -on: - pull_request: - branches: - - master - -jobs: - tests: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Set up Go - uses: actions/setup-go@v4 - with: - go-version: "1.20" - - name: Test Workflow - run: make project_build - \ No newline at end of file diff --git a/.gitignore b/.gitignore index 725f427..82c7e44 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ Dockerfile.initium *.init_test* initium_onmain.yaml -initium_onbranch.yaml \ No newline at end of file +initium_onbranch.yaml +dist/ diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..a65edfe --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,45 @@ +# This is an example .goreleaser.yml file with some sensible defaults. +# Make sure to check the documentation at https://goreleaser.com +before: + hooks: + # You may remove this if you don't use go modules. + - go mod tidy + # you may remove this if you don't need go generate + - go generate ./... +builds: + - env: + - CGO_ENABLED=0 + goos: + - linux + - windows + - darwin + +archives: + - format: tar.gz + # this name template makes the OS and Arch compatible with the results of uname. + name_template: >- + {{ .ProjectName }}_ + {{- title .Os }}_ + {{- if eq .Arch "amd64" }}x86_64 + {{- else if eq .Arch "386" }}i386 + {{- else }}{{ .Arch }}{{ end }} + {{- if .Arm }}v{{ .Arm }}{{ end }} + # use zip for windows archives + format_overrides: + - goos: windows + format: zip +checksum: + name_template: 'checksums.txt' +snapshot: + name_template: "{{ incpatch .Version }}-next" +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:' + +# The lines beneath this are called `modelines`. See `:help modeline` +# Feel free to remove those if you don't want/use them. +# yaml-language-server: $schema=https://goreleaser.com/static/schema.json +# vim: set ts=2 sw=2 tw=0 fo=cnqoj diff --git a/README.md b/README.md index ee5edb1..0e600bf 100644 --- a/README.md +++ b/README.md @@ -17,14 +17,6 @@ All with a nice development workflow in mind like ephemeral environment for your - [Rancher Desktop](https://rancherdesktop.io/) ( cross-platform, FOSS ) - [lima](https://github.com/lima-vm/lima) + [nerdctl](https://github.com/containerd/nerdctl) ( macOS only ) - -### Run from code - -1. Run `go run main.go --project-directory example build` -2. Run `docker run ghcr.io/nearform/initium-cli:latest` -3. You should see the `KKA-CLI from NearForm` output in your console -4. Remove the image `docker image rmi -f ghcr.io/nearform/k8s-kurated-addons-cli:latest` - ### Build the executable In order to build the executable you simply need to run diff --git a/assets/github/onbranch.tmpl b/assets/github/onbranch.tmpl index 97d24a7..1ead18c 100644 --- a/assets/github/onbranch.tmpl +++ b/assets/github/onbranch.tmpl @@ -16,7 +16,7 @@ jobs: - name: delete application if: github.event.action == 'closed' - uses: docker://ghcr.io/nearform/k8s-kurated-addons-cli:latest + uses: docker://ghcr.io/nearform/initium-cli:latest with: args: onbranch --clean env: @@ -28,7 +28,7 @@ jobs: - name: build and deploy application if: github.event.action != 'closed' - uses: docker://ghcr.io/nearform/k8s-kurated-addons-cli:latest + uses: docker://ghcr.io/nearform/initium-cli:latest with: args: onbranch env: diff --git a/assets/github/onmain.tmpl b/assets/github/onmain.tmpl index 2504111..fa3cafc 100644 --- a/assets/github/onmain.tmpl +++ b/assets/github/onmain.tmpl @@ -13,7 +13,7 @@ jobs: - uses: actions/checkout@v2 - name: build and deploy on {{ .DefaultBranch }} - uses: docker://ghcr.io/nearform/k8s-kurated-addons-cli:latest + uses: docker://ghcr.io/nearform/initium-cli:latest with: args: onmain env: diff --git a/quick-start.md b/quick-start.md index 5699c5c..7e59a4d 100644 --- a/quick-start.md +++ b/quick-start.md @@ -1,20 +1,20 @@ # Quick Start Guide -#### k8s-kurated-addons-cli +#### initium-cli This is a guide to help developers start using this repository. Even though it's based on a cluster spawned by k8s-kurated-addons, as long as the destination cluster has knative, the CLI will work. ### Prerequisites - The project's dependencies as described in [the README](README.md) -- `tilt` (if using `k8s-kurated-addons` to bring up the cluster) +- `tilt` (if using `initium-platform` to bring up the cluster) ### Using the software Follow the steps: 1. Install kka-cli (run `make build` and copy the executable to PATH) -2. If you want to use `k8s-kurated-addons`, clone it and run `make` +2. If you want to use `initium-platform`, clone it and run `make` * this will bring up a cluster using kind (kubernetes in Docker) 3. Wait for the cluster to stabilize * it's easier to spot checking `tilt` and `argocd` (they will show everything green) @@ -22,12 +22,12 @@ Follow the steps: 5. Clone the new repo 6. Get argocd-password, enable and access the argocd port forward from Tilt 7. Create a new branch from main / master in the repo -8. Run `kka-cli --app-name init config > .kka` +8. Run `initium --app-name init config > .kka` * the app name needs to be unique since it will be used by knative to expose its service * it’s going to be on the domain GitHub Actions will output * if the organization name or GitHub account has uppercase characters, you will need to edit the `.kka` file and change the repo-name to a fully lowercase string -9. Run `kka-cli init github` -10. Run `kka-cli init service-account | kubectl apply -f -` to create the service account +9. Run `initium init github` +10. Run `initium init service-account | kubectl apply -f -` to create the service account 11. Run the following script: ``` export KKA_LB_ENDPOINT="$(kubectl get service -n istio-ingress istio-ingressgateway -o go-template='{{(index .status.loadBalancer.ingress 0).ip}}'):80" diff --git a/renovate.json b/renovate.json index a7e55b7..e263ad1 100644 --- a/renovate.json +++ b/renovate.json @@ -47,7 +47,7 @@ "prConcurrentLimit": 0, "rebaseWhen": "auto", "repositories": [ - "nearform/k8s-kurated-addons-cli" + "nearform/initium-cli" ], "username": "nearform-renovate-app[bot]", "regexManagers": [