diff --git a/install_scripts/darwin/install.sh b/install_scripts/darwin/install.sh deleted file mode 100644 index 54139c3..0000000 --- a/install_scripts/darwin/install.sh +++ /dev/null @@ -1,2 +0,0 @@ -mv harness /usr/local/bin/ -chmod +x /usr/local/bin/harness \ No newline at end of file diff --git a/install_scripts/linux/install.sh b/install_scripts/linux/install.sh deleted file mode 100644 index 54139c3..0000000 --- a/install_scripts/linux/install.sh +++ /dev/null @@ -1,2 +0,0 @@ -mv harness /usr/local/bin/ -chmod +x /usr/local/bin/harness \ No newline at end of file diff --git a/login.go b/login.go index 9aeec90..b4b4fc5 100644 --- a/login.go +++ b/login.go @@ -9,7 +9,7 @@ import ( func Login(ctx *cli.Context) (err error) { fmt.Println("Welcome to Harness CLI!") PromptAccountDetails(ctx) - getAccountDetails(ctx) saveCredentials(ctx) + getAccountDetails(ctx) return nil } diff --git a/main.go b/main.go index 9c7c1b7..9fb20e4 100644 --- a/main.go +++ b/main.go @@ -294,7 +294,6 @@ func main() { Usage: "Login with account identifier and api key.", Flags: globalFlags, Action: func(context *cli.Context) error { - return cliWrapper(Login, context) }, Before: func(ctx *cli.Context) error { diff --git a/utils.go b/utils.go index 3fb3cd8..0094510 100644 --- a/utils.go +++ b/utils.go @@ -88,12 +88,12 @@ func writeToFile(text string, filename string, overwrite bool) { func readFromFile(filepath string) (s string) { var _fileContents = "" - file, fileError := os.OpenFile(filepath, os.O_RDONLY, 0644) + file, _ := os.OpenFile(filepath, os.O_RDONLY, 0644) defer file.Close() byteValue, readError := io.ReadAll(file) if readError != nil { - log.Println("Error reading from file:", fileError) + //log.Println("Error reading from file:", fileError) } _fileContents = string(byteValue) @@ -102,7 +102,6 @@ func readFromFile(filepath string) (s string) { func saveCredentials(c *cli.Context) (err error) { baseURL := c.String("base-url") - if baseURL == "" { baseURL = cliCdRequestData.BaseUrl } @@ -112,7 +111,7 @@ func saveCredentials(c *cli.Context) (err error) { authCredentials := SecretStore{ ApiKey: cliCdRequestData.AuthToken, AccountId: cliCdRequestData.Account, - BaseURL: cliCdRequestData.BaseUrl, + BaseURL: baseURL, } jsonObj, err := json.MarshalIndent(authCredentials, "", " ") if err != nil { @@ -152,8 +151,12 @@ func hydrateCredsFromPersistence(params ...interface{}) { return } if hydrateOnlyURL { - - cliCdRequestData.BaseUrl = secretstore.BaseURL + baseURL := c.String("base-url") + if baseURL == "" { + cliCdRequestData.BaseUrl = secretstore.BaseURL + } else { + cliCdRequestData.BaseUrl = baseURL + } } else { cliCdRequestData.AuthToken = secretstore.ApiKey cliCdRequestData.Account = secretstore.AccountId diff --git a/workflows/release.yaml b/workflows/release.yaml deleted file mode 100644 index 7712633..0000000 --- a/workflows/release.yaml +++ /dev/null @@ -1,54 +0,0 @@ -on: - release: - types: [created] - push: - branches: [ "feat/install-cli" ] - pull_request: - branches: [ "feat/install-cli" ] -permissions: - contents: write - packages: write - -jobs: - releases-matrix: - name: Release Go Binary - runs-on: ubuntu-latest - strategy: - matrix: - # build and publish in parallel: linux/386, linux/amd64, linux/arm64, windows/386, windows/amd64, darwin/amd64, darwin/arm64 - goos: [linux, windows, darwin] - goarch: [amd64, arm64] - exclude: - - goarch: arm64 - goos: darwin - - goarch: arm64 - goos: windows - steps: - - uses: actions/checkout@v3 - - uses: wangyoucao577/go-release-action@v1.34 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - goos: ${{ matrix.goos }} - goarch: ${{ matrix.goarch }} - goversion: 1.19 - project_path: "." - binary_name: "harness" - ldflags: ${{ format('-X "main.Version={0}"', github.ref_name) }} - - - name: Move binary to the release directory - run: | - mkdir release - mv harness release/ - cp ./install_scripts/${{ matrix.goos }}/* release/ - working-directory: ${{ github.workspace }} - - - name: Bundle everything inside release directory - run: | - tar czvf release.tar.gz release/ - working-directory: ${{ github.workspace }} - - - name: Upload release artifacts - uses: actions/upload-artifact@v2 - with: - name: release-artifacts - path: release.tar.gz \ No newline at end of file