Skip to content

fix go version

fix go version #2

Workflow file for this run

name: Build and Release tfenv
on:
push:
tags:
- "v*"
jobs:
build:
name: Build CLI for Multiple Platforms
runs-on: ubuntu-latest
strategy:
matrix:
goos: [windows, linux, darwin]
goarch: [amd64, arm64]
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.24"
- name: Build Executable
run: |
mkdir -p build
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o build/tfenv-${{ matrix.goos }}-${{ matrix.goarch }}
- name: Create Windows Installer Script
if: matrix.goos == 'windows'
run: |
echo '$destPath = "C:\Program Files\tfenv"' > build/install.ps1
echo '$exePath = "$destPath\tfenv.exe"' >> build/install.ps1
echo 'if (!(Test-Path $destPath)) { New-Item -ItemType Directory -Path $destPath | Out-Null }' >> build/install.ps1
echo 'Copy-Item "tfenv.exe" -Destination $exePath -Force' >> build/install.ps1
echo '$envPath = [System.Environment]::GetEnvironmentVariable("Path", [System.EnvironmentVariableTarget]::Machine)' >> build/install.ps1
echo 'if ($envPath -notlike "*$destPath*") { [System.Environment]::SetEnvironmentVariable("Path", "$envPath;$destPath", [System.EnvironmentVariableTarget]::Machine) }' >> build/install.ps1
echo 'Write-Host "✅ Installation complete. Restart the terminal and run ''tfenv''."' >> build/install.ps1
- name: Create macOS/Linux Install Script
if: matrix.goos != 'windows'
run: |
echo '#!/bin/bash' > build/install.sh
echo 'DEST_PATH="/usr/local/bin/tfenv"' >> build/install.sh
echo 'sudo mv tfenv-${{ matrix.goos }}-${{ matrix.goarch }} $DEST_PATH' >> build/install.sh
echo 'sudo chmod +x $DEST_PATH' >> build/install.sh
echo 'echo "✅ Installation complete! Run ''tfenv'' to use the CLI."' >> build/install.sh
chmod +x build/install.sh
- name: Upload Release Assets
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.ref_name }}
name: "Release ${{ github.ref_name }}"
draft: false
prerelease: false
files: |
build/tfenv-${{ matrix.goos }}-${{ matrix.goarch }}
build/install.ps1
build/install.sh