Skip to content

Commit

Permalink
compiled upgradeGithubRelease using go compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
fchastanet committed Sep 7, 2024
1 parent d7cb815 commit 818706e
Show file tree
Hide file tree
Showing 11 changed files with 2,111 additions and 1,575 deletions.
3,147 changes: 1,803 additions & 1,344 deletions bin/upgradeGithubRelease

Large diffs are not rendered by default.

29 changes: 0 additions & 29 deletions src/_binaries/Git/testsData/upgradeGithubRelease.help.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,35 +86,6 @@ retrieve latest binary release from github and install it

--current-version|-c and --version-arg are mutually exclusive, you cannot use both argument at the same time.

GITHUB TEMPLATE URLS EXAMPLES:

Simple ones(Sometimes @version@ template variable has to be specified twice):
"https://github.com/hadolint/hadolint/releases/download/v@version@/hadolint-Linux-x86_64"
"https://github.com/koalaman/shellcheck/releases/download/v@version@/shellcheck-v@[email protected]_64.tar.xz"
"https://github.com/sharkdp/fd/releases/download/v@version@/fd_@version@_amd64.deb"
"https://github.com/sharkdp/bat/releases/download/v@version@/bat_@version@_amd64.deb"
"https://github.com/kubernetes-sigs/kind/releases/download/v@version@/kind-linux-amd64"
"https://github.com/kubernetes/minikube/releases/download/v@version@/minikube-linux-amd64"
"https://github.com/plantuml/plantuml/releases/download/v@version@/plantuml-@[email protected]"
"https://github.com/Versent/saml2aws/releases/download/v@version@/saml2aws_@version@_linux_amd64.tar.gz"

If you want to add a condition on architecture(linux, windows, x86, 64/32 bits):
"https://github.com/docker/compose/releases/download/v@version@/docker-compose-$(uname -s | tr "[:upper:]" "[:lower:]")-$(uname -m)"
"https://github.com/docker/docker-credential-helpers/releases/download/v@version@/docker-credential-wincred-v@[email protected]$(dpkg --print-architecture).exe"
"https://github.com/Blacksmoke16/oq/releases/download/v@version@/oq-v@version@-$(uname -s)-$(uname -m)"

COMMAND EXAMPLES:
Download docker-compose latest version
upgradeGithubRelease /usr/local/bin/docker-compose \
"https://github.com/docker/compose/releases/download/v@version@/docker-compose-$(uname -s | tr "[:upper:]" "[:lower:]")-$(uname -m)"

Download oq specific version
upgradeGithubRelease /usr/local/bin/oq --exact-version 1.3.4 \
"https://github.com/Blacksmoke16/oq/releases/download/v@version@/oq-v@version@-$(uname -s)-$(uname -m)"

Download oq specific version correctly retrieving the oq version and not the jq one
upgradeGithubRelease /usr/local/bin/oq --exact-version 1.3.4 --version-arg '-V | grep oq:' \
"https://github.com/Blacksmoke16/oq/releases/download/v@version@/oq-v@version@-$(uname -s)-$(uname -m)"

VERSION: 2.0

Expand Down
34 changes: 0 additions & 34 deletions src/_binaries/Git/upgradeGithubRelease.help.txt

This file was deleted.

120 changes: 0 additions & 120 deletions src/_binaries/Git/upgradeGithubRelease.options.tpl

This file was deleted.

47 changes: 0 additions & 47 deletions src/_binaries/Git/upgradeGithubRelease.sh

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
SYNOPSIS:
Retrieve latest binary release from github and install it.

USAGE: upgradeGithubRelease [OPTIONS] [ARGUMENTS]
USAGE: upgradeGithubRelease [--help|-h] [--config]
[--bash-framework-config <bash-framework-config>] [--verbose|-v] [-vv] [-vvv]
[--env-file <env-file>] [--log-level <log-level>] [--log-file <log-file>]
[--display-level <display-level>] [--no-color] [--theme <theme>] [--version]
[--quiet|-q] [--version-arg <versionArg>]
[--current-version|-c <currentVersion>] [--exact-version|-e <exactVersion>]

ARGUMENTS:
targetFile {single} (mandatory)
The binary downloaded will be written to this file path. Ensure the path
is writable.
githubUrlPattern {single} (mandatory)
The url pattern to use to download the binary, see examples below.
@version@ is template variable that will be replaced by the latest
version tag found on github.

GLOBAL OPTIONS:
--help, -h {single}
Displays this command help
--config {single}
Displays configuration
--bash-framework-config <bash-framework-config> {single}
Use alternate bash framework configuration.
--verbose, -v {single}
Info level verbose mode (alias of --display-level INFO)
-vv {single}
Debug level verbose mode (alias of --display-level DEBUG)
-vvv {single}
Trace level verbose mode (alias of --display-level TRACE)
--env-file <env-file> {list} (optional)
Load the specified env file (deprecated, please use --bash-framework-con
fig option instead)
--log-level <log-level> {single}
Set log level
Possible values: OFF, ERR, ERROR, WARN, WARNING, INFO, DEBUG, TRACE
--log-file <log-file> {single}
Set log file
--display-level <display-level> {single}
Set display level
Possible values: OFF, ERR, ERROR, WARN, WARNING, INFO, DEBUG, TRACE
--no-color {single}
Produce monochrome output. alias of --theme noColor.
--theme <theme> {single}
Choose color theme - default-force means colors will be produced even if
command is piped.
Possible values: default, default-force, noColor
Default value: default
--version {single}
Print version information and quit.
--quiet, -q {single}
Quiet mode, doesn't display any output.

VERSION MANAGEMENT:
--version-arg <versionArg> {single}
The argument that will be provided to the currently installed binary
to check the version of the software. See options constraints below.

Default value: --version
--current-version, -c <currentVersion> {single}
Sometimes the command to retrieve the version is complicated.
Some command needs you to parse json or other commands
that provides multiple sub command versions.
In this case you can provide the version you currently have.
See options constraints and examples below.
--exact-version, -e <exactVersion> {single}
If provided and currently installed binary is not this exactVersion,
this exact version of the binary will be installed.
See options constraints below.


DESCRIPTION:
GITHUB TEMPLATE URLS EXAMPLES:

Simple ones(Sometimes @version@ template variable has to be specified twice):
"https://github.com/hadolint/hadolint/releases/download/v@version@/hadolint-Linux-x86_64"
"https://github.com/koalaman/shellcheck/releases/download/v@version@/shellcheck-v@[email protected]_64.tar.xz"
"https://github.com/sharkdp/fd/releases/download/v@version@/fd_@version@_amd64.deb"
"https://github.com/sharkdp/bat/releases/download/v@version@/bat_@version@_amd64.deb"
"https://github.com/kubernetes-sigs/kind/releases/download/v@version@/kind-linux-amd64"
"https://github.com/kubernetes/minikube/releases/download/v@version@/minikube-linux-amd64"
"https://github.com/plantuml/plantuml/releases/download/v@version@/plantuml-@[email protected]"
"https://github.com/Versent/saml2aws/releases/download/v@version@/saml2aws_@version@_linux_amd64.tar.gz"

If you want to add a condition on architecture(linux, windows, x86, 64/32 bits):
"https://github.com/docker/compose/releases/download/v@version@/docker-compose-$(uname -s | tr "[:upper:]" "[:lower:]")-$(uname -m)"
"https://github.com/docker/docker-credential-helpers/releases/download/v@version@/docker-credential-wincred-v@[email protected]$(dpkg --print-architecture).exe"
"https://github.com/Blacksmoke16/oq/releases/download/v@version@/oq-v@version@-$(uname -s)-$(uname -m)"

COMMAND EXAMPLES:

Download docker-compose latest version
upgradeGithubRelease /usr/local/bin/docker-compose \
"https://github.com/docker/compose/releases/download/v@version@/docker-compose-$(uname -s | tr "[:upper:]" "[:lower:]")-$(uname -m)"

Download oq specific version
upgradeGithubRelease /usr/local/bin/oq --exact-version 1.3.4 \
"https://github.com/Blacksmoke16/oq/releases/download/v@version@/oq-v@version@-$(uname -s)-$(uname -m)"

Download oq specific version correctly retrieving the oq version and not the jq one
upgradeGithubRelease /usr/local/bin/oq --exact-version 1.3.4 --version-arg '-V | grep oq:' \
"https://github.com/Blacksmoke16/oq/releases/download/v@version@/oq-v@version@-$(uname -s)-$(uname -m)"


VERSION: 3.0

AUTHOR: [François Chastanet](https://github.com/fchastanet)

SOURCE FILE: https://github.com/fchastanet/bash-tools-framework/tree/master/src/_binaries/Git/upgradeGithubRelease/upgradeGithubRelease-binary.yaml

LICENSE: MIT License
Copyright (c) 2020-now François Chastanet
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

echo "1.0.0"
Loading

0 comments on commit 818706e

Please sign in to comment.