diff --git a/.github/workflows/tailscale.yml b/.github/workflows/tailscale.yml deleted file mode 100644 index 3c61eb1..0000000 --- a/.github/workflows/tailscale.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: tailscale - -on: - workflow_dispatch: - push: - branches: - - main - pull_request: - branches: - - '*' - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Check out code - uses: actions/checkout@v2 - - - name: Tailscale Action - uses: ./ - with: - oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }} - oauth-secret: ${{ secrets.TS_OAUTH_SECRET }} - tags: tag:ci - - - name: check for hello.ts.net in netmap - run: - tailscale status | grep -q hello diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..17a6f8d --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,64 @@ +name: testing tfswitch action + +on: + push: + branches: + +jobs: + test-terraform-version-file: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ./ + - name: run tfswitch for .terraform-version file + run: | + echo "1.6.3" > .terraform-version + tfswitch + terraform --version + + test-command-line-version: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ./ + - name: run tfswitch with the version on the command line + run: | + tfswitch 1.6.2 + terraform --version + + test-env-var-version: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ./ + - name: run tfswitch with the version in an env var + run: | + export TF_VERSION=1.6.1 + tfswitch 1.6.2 + terraform --version + + test-install-latest-version: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ./ + - name: run tfswitch with the version in an env var + run: | + tfswitch -u + terraform --version + + test-terraform-tf-file: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ./ + - name: run tfswitch with the version in an env var + run: | + cat << EOF > versions.tf + terraform { + required_version = ">= 0.12.9" + } + EOF + tfswitch + terraform --version + \ No newline at end of file diff --git a/action.yml b/action.yml index 41dc9a6..fc34a5c 100644 --- a/action.yml +++ b/action.yml @@ -6,6 +6,7 @@ inputs: version: description: 'The tfswitch version' required: false + default: "0.13.1308" runs: using: 'composite' @@ -16,17 +17,17 @@ runs: run: | echo "::error title=⛔ error hint::This action is only supported on Linux Runners" exit 1 - - name: Download and install tfswitch + - name: Install tfswitch shell: bash - id: download + id: install # env: # VERSION: ${{ inputs.version }} - # SHA256SUM: ${{ inputs.sha256sum }} + # SHA256SUM: ${{ inputs.sha256sum }} run: | curl -sLo install.sh https://raw.githubusercontent.com/warrensbox/terraform-switcher/release/install.sh chmod 755 install.sh mkdir -p $HOME/.bin - ./install.sh -b $HOME/.bin + ./install.sh ${{ inputs.version }} -b $HOME/.bin $HOME/.bin/tfswitch --version export PATH=$PATH:$HOME/.bin tfswitch --version