Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

bitflight-devops/shell-scripts

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

174 Commits
174 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shell Script Utilities

Use in Github actions

- uses: bitflight-devops/shell-scripts@v2
  name: Install shell utility scripts

CLI Install

Install Options as Environment Vars:

  • INTERACTIVE=1 force interactive mode (default when running in a terminal)
  • NONINTERACTIVE=1 force non-interactive mode (default when in CI environment)

Make sure that you have downloader like curl: Debian & Ubuntu: apt-get update -y -qq && apt-get install -y -qq curl Yum & CentOS: yum install -y -q curl

Install without prompts

sudo -v 2>/dev/null || true # Prompt for sudo first
NONINTERACTIVE=1 source <(curl -sL "https://raw.githubusercontent.com/bitflight-devops/shell-scripts/main/install.sh")
source "$BFD_REPOSITORY/lib/bootstrap.sh" || true

CLI Usage

Load the functions:

# SILENT_BOOTSTRAP=1 # disable info logs if uncommented
. lib/bootstrap.sh

Add this to the top of scripts that need to use the functions:

#!/usr/bin/env bash
if [[ -z ${BFD_REPOSITORY:-} ]]; then
  if [[ -x "/home/bitflight-devops/.shell-scripts" ]]; then
    export BFD_REPOSITORY="/home/bitflight-devops/.shell-scripts"
  elif [[ -x "${HOME}/.shell-scripts" ]]; then
    export BFD_REPOSITORY="${HOME}/.shell-scripts"
  elif [[ -x "/usr/local/.shell-scripts" ]]; then
    export BFD_REPOSITORY="usr/local/.shell-scripts"
  elif [[ -x "/opt/bitflight-devops/.shell-scripts" ]]; then
    export BFD_REPOSITORY="/opt/bitflight-devops/.shell-scripts"
  fi
fi

if [[ -n ${BFD_REPOSITORY:-} ]]; then
  source "${BFD_REPOSITORY}/lib/bootstrap.sh" || true
elif [[ -n "${SCRIPTS_LIB_DIR}" ]]; then
  source "${SCRIPTS_LIB_DIR}/bootstrap.sh" || true
else
  if command -v curl >/dev/null 2>&1; then
    NONINTERACTIVE=1 source <(curl -sL "https://raw.githubusercontent.com/bitflight-devops/shell-scripts/main/install.sh") || true
  elif command -v wget >/dev/null 2>&1; then
    NONINTERACTIVE=1 source <(wget -q "https://raw.githubusercontent.com/bitflight-devops/shell-scripts/main/install.sh") || true
  fi
  if [[ -x "${SCRIPTS_LIB_DIR}/bootstrap.sh" ]]; then
    source "${SCRIPTS_LIB_DIR}/bootstrap.sh" || true
  else
    echo "Failed to run bootstrap.sh"
    echo "Please install the shell-scripts repository from github.com/bitflight-devops/shell-scripts"
  fi
fi

## Continue the script

Action Usage

GitHub Action Inputs

GitHub Action Outputs

Testing

This project uses shUnit2 for testing. It is included as a submodule in the tests directory. To run the tests, run ./tests/run.sh from the root of the repository.

About

Scripts that simplify complex tasks, especially for GitHub Actions.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Morty Proxy This is a proxified and sanitized view of the page, visit original site.