Compare commits
No commits in common. "new/version-input" and "main" have entirely different histories.
new/versio
...
main
@ -28,19 +28,4 @@ jobs:
|
||||
|
||||
- name: "check go installed command"
|
||||
shell: bash
|
||||
run: mctl -v | grep "mctl version v0.3.4"
|
||||
|
||||
- name: "remove go"
|
||||
shell: bash
|
||||
env:
|
||||
GO_INSTALL_COMMANDS: code.jakeyoungdev.com/jake/mctl@v0.3.4
|
||||
GO_INSTALL_PURGE: yes
|
||||
GO_INSTALL_VERSION: 1.23.2
|
||||
GO_INSTALL_ARCH: amd64
|
||||
run: |
|
||||
rm go.mod
|
||||
./install.sh
|
||||
|
||||
- name: "check go version"
|
||||
shell: bash
|
||||
run: go version | grep "go version go1.23.2 linux/amd64"
|
||||
run: mctl -v | grep "mctl version v0.3.4"
|
@ -14,16 +14,15 @@ Use a tagged release to avoid unexpected changes that may come to the master bra
|
||||
```
|
||||
|
||||
#### Go verions
|
||||
The Go version installed is determined by the version specified in the go.mod file. If not mod file is present the 'version' input is used. Go files are pulled directly from the Go download [site](https://go.dev/dl/) and all go commands are installed using 'go install' after setup. If a different version of Go is already installed the 'purge' input must be set to 'yes' to remove it and avoid errors.
|
||||
|
||||
Go version is determined using the go.mod file in the root of working directory. Go files are pulled directly from the go download [site](https://go.dev/dl/) and all go commands are installed using 'go install' after setup. If a Go version is already present the 'purge' input must be set to 'yes' to avoid errors.
|
||||
#### Inputs
|
||||
Some inputs are available to customize the installation
|
||||
|Input|Required|Values|Default|Description|
|
||||
|---|---|---|---|---|
|
||||
|arch|no|any arch for Go|amd64|system architecture for go
|
||||
|purge|no|yes/no|no|remove any go files found on system before install
|
||||
|arch|no|any arch for Go|amd64|system architecture for golang
|
||||
|purge|no|yes/no|no|remove any golang files found on system before install
|
||||
|commands|no|any public go repositories|.|links to any commands to be installed using 'go install'
|
||||
|version|no|any go version|.|the go version to use if no mod file is present
|
||||
|
||||
|
||||
## Issues
|
||||
This repo is a as brain-dead as I could make it and is intended to be as fast and low-level as possible. Please open an issue for any problems or suggestions.
|
@ -13,10 +13,6 @@ inputs:
|
||||
description: "Optional, any commands to be installed with 'go install', must include version"
|
||||
required: false
|
||||
default: "."
|
||||
version:
|
||||
description: "Optional, the Go version to install if no go.mod file is present"
|
||||
required: false
|
||||
default: "."
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
@ -26,5 +22,4 @@ runs:
|
||||
env:
|
||||
GO_INSTALL_COMMANDS: ${{ inputs.commands }}
|
||||
GO_INSTALL_ARCH: ${{ inputs.arch }}
|
||||
GO_INSTALL_PURGE: ${{ inputs.purge }}
|
||||
GO_INSTALL_VERSION: ${{ inputs.version }}
|
||||
GO_INSTALL_PURGE: ${{ inputs.purge }}
|
42
install.sh
42
install.sh
@ -18,19 +18,6 @@ function installCommands {
|
||||
fi
|
||||
}
|
||||
|
||||
function fixVersion {
|
||||
DL_VSPL=( $DL_VERSION_RAW )
|
||||
DL_VERSION="${DL_VSPL[1]}"
|
||||
|
||||
#ensure we have patch-level version, if not add 0 for stable releases
|
||||
# -P uses perl syntax
|
||||
DL_VERSION_PAD_CHECK="$(grep "^go [0-9]+.[0-9]+.[0-9]+" go.mod -P)"
|
||||
if [[ -z "$DL_VERSION_PAD_CHECK" ]]; then
|
||||
DL_VERSION="$DL_VERSION"".0"
|
||||
echo "Fixing version number to ${DL_VERSION}"
|
||||
fi
|
||||
}
|
||||
|
||||
#start script
|
||||
echo "Starting Golang install"
|
||||
|
||||
@ -40,29 +27,22 @@ echo "Parsing go version"
|
||||
# -P uses perl syntax
|
||||
DL_VERSION_RAW="$(grep "^go [0-9]+.[0-9]+" go.mod -P)"
|
||||
if [[ -z "$DL_VERSION_RAW" ]]; then
|
||||
#no go.mod file found
|
||||
DL_VERSION_RAW=$GO_INSTALL_VERSION
|
||||
#no version input set either
|
||||
if [[ "$DL_VERSION_RAW" == "." ]]; then
|
||||
echo "FATAL: No Go version found, set version input if no go.mod file is present"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
fixVersion
|
||||
echo "FATAL: Unable to pull version from go.mod"
|
||||
exit 1
|
||||
fi
|
||||
echo "Found go version: ${DL_VERSION_RAW}"
|
||||
|
||||
DL_ARCH=$GO_INSTALL_ARCH
|
||||
# DL_VSPL=( $DL_VERSION_RAW )
|
||||
# DL_VERSION="${DL_VSPL[1]}"
|
||||
DL_VSPL=( $DL_VERSION_RAW )
|
||||
DL_VERSION="${DL_VSPL[1]}"
|
||||
|
||||
# #ensure we have patch-level version, if not add 0 for stable releases
|
||||
# # -P uses perl syntax
|
||||
# DL_VERSION_PAD_CHECK="$(grep "^go [0-9]+.[0-9]+.[0-9]+" go.mod -P)"
|
||||
# if [[ -z "$DL_VERSION_PAD_CHECK" ]]; then
|
||||
# DL_VERSION="$DL_VERSION"".0"
|
||||
# echo "Fixing version number to ${DL_VERSION}"
|
||||
# fi
|
||||
#ensure we have patch-level version, if not add 0 for stable releases
|
||||
# -P uses perl syntax
|
||||
DL_VERSION_PAD_CHECK="$(grep "^go [0-9]+.[0-9]+.[0-9]+" go.mod -P)"
|
||||
if [[ -z "$DL_VERSION_PAD_CHECK" ]]; then
|
||||
DL_VERSION="$DL_VERSION"".0"
|
||||
echo "Fixing version number to ${DL_VERSION}"
|
||||
fi
|
||||
|
||||
echo "Checking if go is already installed"
|
||||
#check if go is already present before starting install process and delete files if purge input is set
|
||||
|
Loading…
x
Reference in New Issue
Block a user