Compare commits

..

14 Commits
v0.1.0 ... main

Author SHA1 Message Date
d45fdbf3ca Update README.md
All checks were successful
test / test (push) Successful in 18s
2025-05-23 01:32:32 +00:00
fb7e640162 feature/version-check (#2)
Some checks failed
test / test (push) Has been cancelled
Reviewed-on: #2
2025-05-23 01:31:38 +00:00
2785d64c02 Update README.md
All checks were successful
test / test (push) Successful in 21s
2025-04-20 05:28:17 +00:00
09214e49b9 [config] revert trigger changes
All checks were successful
test / test (push) Successful in 15s
2025-04-04 14:27:53 -04:00
67be40ad0d [config] Workflow trigger updates
All checks were successful
test / test (push) Successful in 15s
2025-04-04 14:25:59 -04:00
8febe20c2a Update README.md
All checks were successful
test / test (push) Successful in 16s
2025-04-04 18:24:32 +00:00
86ce64c8d1 readme update
All checks were successful
test / test (push) Successful in 16s
2025-04-04 14:23:12 -04:00
0a2cc6f296 Merge pull request 'fix/bugfix-input' (#1) from fix/bugfix-input into master
All checks were successful
test / test (push) Successful in 15s
Reviewed-on: #1
2025-04-04 18:19:13 +00:00
23d8078bcf revert test trigger for merge 2025-04-04 14:16:47 -04:00
0e0785fb67 [test] fixing workflow
All checks were successful
test / test (push) Successful in 17s
- workflow had a bug around env vars
- was expecting inputs vs env
2025-04-04 14:15:24 -04:00
4a01816864 [test] workflow trigger
Some checks failed
test / test (push) Failing after 4s
2025-04-04 14:10:21 -04:00
5b464d64cc [test] workflow trigger 2025-04-04 14:09:38 -04:00
ae390bc529 [fix] Requiring arch input with default 2025-04-04 14:08:59 -04:00
aa2d4b0a5c file permissions update
Some checks failed
test / test (push) Failing after 4s
2025-04-03 23:44:00 -04:00
4 changed files with 41 additions and 33 deletions

View File

@ -1,14 +1,10 @@
name: "test" name: "test"
run-name: "test" run-name: "test"
on: on: push
push:
tags:
- "v*"
- "!v*-beta*"
jobs: jobs:
test: test:
runs-on: [smoketest] runs-on: action
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@ -20,10 +16,11 @@ jobs:
- name: "run go install script" - name: "run go install script"
shell: bash shell: bash
env: 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
run: | run: |
chmod +x install.sh chmod +x install.sh
./install.sh amd64 no ./install.sh
- name: "check go version" - name: "check go version"
shell: bash shell: bash
@ -31,4 +28,4 @@ jobs:
- name: "check go installed command" - name: "check go installed command"
shell: bash shell: bash
run: kelp -v | grep "kelp version v0.0.9" run: mctl -v | grep "mctl version v0.3.4"

View File

@ -1,4 +1,5 @@
# install-go # install-go
![tests](https://code.jakeyoungdev.com/actions/install-go/actions/workflows/test.yaml/badge.svg?branch=main&event=push) <br />
An extremely simple github action to install golang and golang commands (using "go install") on linux hosts. This provides the ability to install and setup golang without node/typescript which is required when using [actions/setup-go](https://github.com/actions/setup-go). An extremely simple github action to install golang and golang commands (using "go install") on linux hosts. This provides the ability to install and setup golang without node/typescript which is required when using [actions/setup-go](https://github.com/actions/setup-go).
@ -9,7 +10,7 @@ Use a tagged release to avoid unexpected changes that may come to the master bra
uses: https://code.jakeyoungdev.com/actions/install-go@master uses: https://code.jakeyoungdev.com/actions/install-go@master
with: with:
commands: | commands: |
github.com/jake-young-dev/kelp@v0.0.9 code.jakeyoungdev.com/jake/mctl@v0.3.3
``` ```
#### Go verions #### Go verions

View File

@ -1,3 +0,0 @@
Comments are left in code using TODO# to track possible implementation location.
TODO1. check current installed version to see if it matches requested install version, only error if they don't match

53
install.sh Normal file → Executable file
View File

@ -1,5 +1,24 @@
#!/bin/bash #!/bin/bash
#installs any commands set in the command input value
function installCommands {
#if commands input is set pull the input and install them all using 'go install'
if [[ "$GO_INSTALL_COMMANDS" != "." ]]; then # "." is used as a default
#allows for multiple cmds using |
INPUT_ARR=( $GO_INSTALL_COMMANDS )
for i in "${INPUT_ARR[@]}"; do
echo "Installing go command from ${i}"
if go install ${i}; then
echo "Command setup for ${i}"
else
echo "FATAL: Unable to install ${i} with go"
exit 1
fi
done
fi
}
#start script
echo "Starting Golang install" echo "Starting Golang install"
#validate version and architecture #validate version and architecture
@ -30,17 +49,24 @@ echo "Checking if go is already installed"
# -v writes string that indicates command or command path to output, prevents command not found error # -v writes string that indicates command or command path to output, prevents command not found error
GO_CHECK=$(command -v go) GO_CHECK=$(command -v go)
if [[ "$GO_CHECK" ]]; then if [[ "$GO_CHECK" ]]; then
#if purge flag is set remove old go files #if the version of go matches the requested version, skip
if [[ "$GO_INSTALL_PURGE" == "yes" ]]; then GVC=$(go version)
if [[ "$GVC" == "go version go${DL_VERSION} linux/${DL_ARCH}" ]]; then
echo "Go ${DL_VERSION} already installed, skipping!"
installCommands
exit 0
fi
#if the purge flag is not set and version does not match, exit
if [[ "$GO_INSTALL_PURGE" != "yes" ]]; then
echo "FATAL: The wrong version of Go is already installed, set purge to 'yes' if you wish to update installed version"
exit 1
else
echo "Removing old go versions" echo "Removing old go versions"
sudo rm -r /usr/bin/go sudo rm -r /usr/bin/go
sudo rm -r /usr/bin/gofmt sudo rm -r /usr/bin/gofmt
else
#TODO1: if installed version matches requested version we can consider the job successful
echo "FATAL: Go is already installed, set purge to 'yes' if you wish to update installed version"
exit 1
fi fi
fi fi
echo "Ready for install" echo "Ready for install"
echo "Downloading go files for ${DL_VERSION}/${DL_ARCH}" echo "Downloading go files for ${DL_VERSION}/${DL_ARCH}"
@ -82,17 +108,4 @@ GP=$(go env GOPATH)/bin
export PATH=$PATH:$GP export PATH=$PATH:$GP
echo "$GP" >> "$GITHUB_PATH" echo "$GP" >> "$GITHUB_PATH"
#if commands input is set pull the input and install them all using 'go install' installCommands
if [[ "$GO_INSTALL_COMMANDS" != "." ]]; then # "." is used as a default
#allows for multiple cmds using |
INPUT_ARR=( $GO_INSTALL_COMMANDS )
for i in "${INPUT_ARR[@]}"; do
echo "Installing go command from ${i}"
if go install ${i}; then
echo "Command setup for ${i}"
else
echo "FATAL: Unable to install ${i} with go"
exit 1
fi
done
fi