From fe9c9a9a4565ceb63297d75037cc2413514817ed Mon Sep 17 00:00:00 2001 From: warrenbox Date: Wed, 22 Jun 2022 22:50:13 -0500 Subject: [PATCH 1/6] added github secret --- .github/workflows/release.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index c591dcf..3e111f4 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -60,10 +60,8 @@ jobs: version: latest args: release --rm-dist env: - GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} RELEASE_VERSION: ${{ steps.vars.outputs.tag }} - CLIENT_ID: ${{ secrets.CLIENT_ID }} - CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} - name: Install Python uses: actions/setup-python@v2 From 283b320de893aa321543e003aae93099cab16c5f Mon Sep 17 00:00:00 2001 From: warrenbox Date: Wed, 22 Jun 2022 23:13:48 -0500 Subject: [PATCH 2/6] bumo tagger 1.39.0 --- .github/workflows/release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 3e111f4..7edc8b7 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -39,7 +39,7 @@ jobs: run: chmod 755 test-tgswitch.sh && ./test-tgswitch.sh - name: Bump version and push tag - uses: anothrNick/github-tag-action@1.26.0 + uses: anothrNick/github-tag-action@1.39.0 id: vars env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From bb888690669d629ffc289be52ff2ae40b63424c0 Mon Sep 17 00:00:00 2001 From: warrenbox Date: Wed, 22 Jun 2022 23:30:09 -0500 Subject: [PATCH 3/6] bump version --- .github/workflows/release.yaml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 7edc8b7..b83f81f 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -14,10 +14,12 @@ jobs: steps: - name: Checkout Repository - uses: actions/checkout@master + uses: actions/checkout@v3 + with: + fetch-depth: 0 - name: Checkout go - uses: actions/setup-go@v2 + uses: actions/setup-go@v3 with: go-version: '1.18' # The Go version to download (if necessary) and use. @@ -54,8 +56,9 @@ jobs: run: | echo $RELEASE_VERSION echo ${{ steps.vars.outputs.tag }} + - name: Install GoReleaser - uses: goreleaser/goreleaser-action@v2 + uses: goreleaser/goreleaser-action@v3 with: version: latest args: release --rm-dist From a4095a50e33158365d17ff33e4b13b740c1e90be Mon Sep 17 00:00:00 2001 From: NathanArmstrong84 Date: Thu, 23 Jun 2022 00:38:47 -0500 Subject: [PATCH 4/6] added client key --- .github/workflows/release.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index b83f81f..4afe412 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -65,6 +65,8 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} RELEASE_VERSION: ${{ steps.vars.outputs.tag }} + CLIENT_ID: ${{ secrets.CLIENT_ID }} + CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} - name: Install Python uses: actions/setup-python@v2 From ac396402346fcf8fd0daad0e3ae070227d70944f Mon Sep 17 00:00:00 2001 From: NathanArmstrong84 Date: Thu, 23 Jun 2022 00:45:29 -0500 Subject: [PATCH 5/6] added personal token --- .github/workflows/release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 4afe412..d93bb4e 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -63,7 +63,7 @@ jobs: version: latest args: release --rm-dist env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.HOMEBREW_TOKEN_TGSWITCH }} RELEASE_VERSION: ${{ steps.vars.outputs.tag }} CLIENT_ID: ${{ secrets.CLIENT_ID }} CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} From 07b165a8bd4b712ba7a4f424a80d2813eaec4177 Mon Sep 17 00:00:00 2001 From: NathanArmstrong84 Date: Thu, 23 Jun 2022 00:56:11 -0500 Subject: [PATCH 6/6] bump minor --- .github/workflows/release.yaml | 2 +- README.md | 122 ++++++++++++++++++--------------- 2 files changed, 67 insertions(+), 57 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index d93bb4e..55d2dde 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -48,7 +48,7 @@ jobs: WITH_V: false INITIAL_VERSION: 0.6.0 RELEASE_BRANCHES: release - DEFAULT_BUMP: patch + DEFAULT_BUMP: minor - name: Check output env: diff --git a/README.md b/README.md index 6689fed..d312b39 100644 --- a/README.md +++ b/README.md @@ -7,25 +7,18 @@ drawing -The `tgswitch` command line tool lets you switch between different versions of [terragrunt](https://www.terragrunt.io/). +The `tgswitch` command line tool lets you switch between different versions of terragrunt. If you do not have a particular version of terragrunt installed, `tgswitch` will download the version you desire. The installation is minimal and easy. Once installed, simply select the version you require from the dropdown and start using terragrunt. - -See installation guide here: [tgswitch installation](https://warrensbox.github.io/tgswitch/) - -***Important** -Please see upcoming changes [Version 0.5](CHANGELOG.md) - ## Installation `tgswitch` is available for MacOS and Linux based operating systems. ### Homebrew -Installation for MacOS is the easiest with Homebrew. [If you do not have homebrew installed, click here](https://brew.sh/). - +Installation for MacOS is the easiest with Homebrew. If you do not have homebrew installed, click here. ```ruby brew install warrensbox/tap/tgswitch @@ -33,7 +26,7 @@ brew install warrensbox/tap/tgswitch ### Linux -Installation for other linux operation systems. +Installation for Linux operation systems. ```sh curl -L https://raw.githubusercontent.com/warrensbox/tgswitch/release/install.sh | bash @@ -41,64 +34,104 @@ curl -L https://raw.githubusercontent.com/warrensbox/tgswitch/release/install.sh ### Install from source -Alternatively, you can install the binary from source [here](https://github.com/warrensbox/tgswitch/releases) +Alternatively, you can install the binary from the source here. +[Having trouble installing](https://tgswitch.warrensbox.com/Troubleshoot/). ## How to use: ### Use dropdown menu to select version -drawing +drawing -1. You can switch between different versions of terragrunt by typing the command `tgswitch` on your terminal. +1. You can switch between different versions of terragrunt by typing the command `tgswitch` on your terminal. 2. Select the version of terragrunt you require by using the up and down arrow. 3. Hit **Enter** to select the desired version. The most recently selected versions are presented at the top of the dropdown. ### Supply version on command line -drawing +drawing 1. You can also supply the desired version as an argument on the command line. -2. For example, `tgswitch 0.10.7` for version 0.10.7 of terragrunt. -3. Hit **Enter** to switch version. +2. For example, `tgswitch 0.37.1` for version 0.37.1 of terragrunt. +3. Hit **Enter** to switch. + +### Use environment variables +drawing +You can also set the `TG_VERSION` environment variable to your desired terragrunt version. +For example: +```bash +export TG_VERSION=0.37.0 +tgswitch #will automatically switch to terragrunt version 0.37.0 +``` -### Use custom installation location (For non-admin - users with limited privilege on their computers) -You can specify a custom binary path for your terragrunt installation +### Use .tgswitch.toml file (For non-admin AND Apple M1 users with limited privilege on their computers) +Specify a custom binary path for your terragrunt installation + +drawing +drawing + +1. Create a custom binary path. Ex: `mkdir /Users/uveerum/bin` (replace uveerum with your username) +2. Add the path to your PATH. Ex: `export PATH=$PATH:/Users/uveerum/bin` (add this to your bash profile or zsh profile) +3. Pass -b or --bin parameter with your custom path to install terragrunt. Ex: `tgswitch -b /Users/uveerum/bin/terragrunt 0.34.0 ` +4. Optionally, you can create a `.tgswitch.toml` file in your terragrunt directory(current directory) OR in your home directory(~/.tgswitch.toml). The toml file in the current directory has a higher precedence than toml file in the home directory +5. Your `.tgswitch.toml` file should look like this: +```ruby +bin = "/usr/local/bin/terragrunt" +version = "0.34.0" +``` +4. Run `tgswitch` and it should automatically install the required terragrunt version in the specified binary path -1. Create a custom binary path. Ex: `mkdir /Users/warrenveerasingam/bin` (replace warrenveerasingam with your username) -2. Add the path to your PATH. Ex: `export PATH=$PATH:/Users/warrenveerasingam/bin` (add this to your bash profile or zsh profile) -3. Pass -b or --bin parameter with your custom path to install terragrunt. Ex: `tgswitch -b /Users/warrenveerasingam/bin/terragrunt 0.14.1 ` +**NOTE** +1. For linux users that do not have write permission to `/usr/local/bin/`, `tgswitch` will attempt to install terragrunt at `$HOME/bin`. Run `export PATH=$PATH:$HOME/bin` to append bin to PATH +2. For windows host, `tgswitch` need to be run under `Administrator` mode, and `$HOME/.tgswitch.toml` with `bin` must be defined (with a valid path) as minimum, below is an example for `$HOME/.tgswitch.toml` on windows +```toml +bin = "C:\\Users\\<%USRNAME%>\\bin\\terragrunt.exe" +``` ### Use .tgswitchrc file -drawing +drawing 1. Create a `.tgswitchrc` file containing the desired version -2. For example, `echo "0.14.1" >> .tgswitchrc` for version 0.14.1 of terragrunt +2. For example, `echo "0.33.0" >> .tgswitchrc` for version 0.33.0 of terragrunt 3. Run the command `tgswitch` in the same directory as your `.tgswitchrc` -#### *Instead of a `.tgswitchrc` file, a `.terragrunt-version` file may be used for compatibility with [`tgenv`](https://github.com/cunymatthieu/tgenv#terragrunt-version) and other tools which use it* +*Instead of a `.tgswitchrc` file, a `.terragrunt-version` file may be used as well* + +### Use terragrunt.hcl file +drawing + +If a terragrunt.hcl file with the terragrunt constrain is included in the current directory, it should automatically download or switch to that terragrunt version. For example, the following should automatically switch terragrunt to version 0.36.0: +```ruby +terragrunt_version_constraint = ">= 0.36, < 0.36.1" +... +``` + +### Get the version from a subdirectory +```bash +tgswitch --chdir terragrunt_dir +tgswitch -c terragrunt_dir +``` **Automatically switch with bash** Add the following to the end of your `~/.bashrc` file: -(Use either `.tgswitchrc` or `.terragrunt-version`) +(Use either `.tgswitchrc` or `.tgswitch.toml` or `.terragrunt-version`) -``` +```sh cdtgswitch(){ builtin cd "$@"; cdir=$PWD; - if [ -f "$cdir/.tgswitchrc" ]; then + if [ -e "$cdir/.tgswitchrc" ]; then tgswitch fi } alias cd='cdtgswitch' ``` -drawing - **Automatically switch with zsh** Add the following to the end of your `~/.zshrc` file: -``` +```sh load-tgswitch() { local tgswitchrc_path=".tgswitchrc" @@ -115,40 +148,17 @@ load-tgswitch > ``` *older version of zsh* -``` +```sh cd(){ builtin cd "$@"; cdir=$PWD; - if [ -f "$cdir/.tgswitchrc" ]; then + if [ -e "$cdir/.tgswitchrc" ]; then tgswitch fi } ``` - -**Automatically switch with fish** - -Add the following to your `~/.config/fish/config.fish` file: - -``` -function cdtgswitch - builtin cd "$argv" - set cdir $PWD - if test -f "$cdir/.tgswitchrc" - tgswitch - end -end -alias cd='cdtgswitch' -``` - -## Additional Info - -See how to *upgrade*, *uninstall*, *troubleshoot* here:[More info](https://warrensbox.github.io/tgswitch/additional) - - ## Issues - Please open *issues* here: [New Issue](https://github.com/warrensbox/tgswitch/issues) ## Upcoming Features - -Use environment variable to change terragrunt version +N/A