From f2ffed2be3e0725cb51ce41fd8d6c032845029e7 Mon Sep 17 00:00:00 2001 From: jake Date: Wed, 21 May 2025 23:35:35 -0400 Subject: [PATCH] implementing version checks --- .gitea/workflows/test.yaml | 9 +++------ action.yaml | 2 +- install.sh | 6 ++++++ 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.gitea/workflows/test.yaml b/.gitea/workflows/test.yaml index 906459d..e80c014 100644 --- a/.gitea/workflows/test.yaml +++ b/.gitea/workflows/test.yaml @@ -2,12 +2,10 @@ name: "test" run-name: "test" on: push: - branches: - - master jobs: test: - runs-on: [smoketest] + runs-on: fire steps: - uses: actions/checkout@v4 @@ -19,9 +17,8 @@ jobs: - name: "run go install script" shell: bash env: - GO_INSTALL_COMMANDS: github.com/jake-young-dev/kelp@v0.0.9 + GO_INSTALL_COMMANDS: code.jakeyoungdev.com/jake/mctl@v0.3.4 GO_INSTALL_ARCH: amd64 - GO_INSTALL_PURGE: no run: | chmod +x install.sh ./install.sh @@ -32,4 +29,4 @@ jobs: - name: "check go installed command" shell: bash - run: kelp -v | grep "kelp version v0.0.9" \ No newline at end of file + run: mctl -v | grep "mctl version v0.3.4" \ No newline at end of file diff --git a/action.yaml b/action.yaml index 0ba21fe..dbe0be6 100644 --- a/action.yaml +++ b/action.yaml @@ -3,7 +3,7 @@ description: "simple and fast install for golang and golang commands on linux wo inputs: arch: description: "Optional, the linux architecture to use when downloading Go files (default: amd64)" - required: true + required: false default: "amd64" purge: description: "Optional, deletes any previously installed go versions (yes|no)" diff --git a/install.sh b/install.sh index 63cf71a..82f985d 100755 --- a/install.sh +++ b/install.sh @@ -37,6 +37,12 @@ if [[ "$GO_CHECK" ]]; then sudo rm -r /usr/bin/gofmt else #TODO1: if installed version matches requested version we can consider the job successful + #go version go1.23.0 linux/amd64 + GVC=$(go version) + if [[ "$GVC" == "go version go${DL_VERSION} linux/${DL_ARCH}" ]]; then + echo "Requested Go version already installed, skipping." + exit 0 + fi echo "FATAL: Go is already installed, set purge to 'yes' if you wish to update installed version" exit 1 fi