├── LICENSE ├── README.md ├── action.yaml └── aqua-installer /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Shunsuke Suzuki 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # aqua-installer 2 | 3 | [![DeepWiki](https://img.shields.io/badge/DeepWiki-aquaproj%2Faqua--installer-blue.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAyCAYAAAAnWDnqAAAAAXNSR0IArs4c6QAAA05JREFUaEPtmUtyEzEQhtWTQyQLHNak2AB7ZnyXZMEjXMGeK/AIi+QuHrMnbChYY7MIh8g01fJoopFb0uhhEqqcbWTp06/uv1saEDv4O3n3dV60RfP947Mm9/SQc0ICFQgzfc4CYZoTPAswgSJCCUJUnAAoRHOAUOcATwbmVLWdGoH//PB8mnKqScAhsD0kYP3j/Yt5LPQe2KvcXmGvRHcDnpxfL2zOYJ1mFwrryWTz0advv1Ut4CJgf5uhDuDj5eUcAUoahrdY/56ebRWeraTjMt/00Sh3UDtjgHtQNHwcRGOC98BJEAEymycmYcWwOprTgcB6VZ5JK5TAJ+fXGLBm3FDAmn6oPPjR4rKCAoJCal2eAiQp2x0vxTPB3ALO2CRkwmDy5WohzBDwSEFKRwPbknEggCPB/imwrycgxX2NzoMCHhPkDwqYMr9tRcP5qNrMZHkVnOjRMWwLCcr8ohBVb1OMjxLwGCvjTikrsBOiA6fNyCrm8V1rP93iVPpwaE+gO0SsWmPiXB+jikdf6SizrT5qKasx5j8ABbHpFTx+vFXp9EnYQmLx02h1QTTrl6eDqxLnGjporxl3NL3agEvXdT0WmEost648sQOYAeJS9Q7bfUVoMGnjo4AZdUMQku50McDcMWcBPvr0SzbTAFDfvJqwLzgxwATnCgnp4wDl6Aa+Ax283gghmj+vj7feE2KBBRMW3FzOpLOADl0Isb5587h/U4gGvkt5v60Z1VLG8BhYjbzRwyQZemwAd6cCR5/XFWLYZRIMpX39AR0tjaGGiGzLVyhse5C9RKC6ai42ppWPKiBagOvaYk8lO7DajerabOZP46Lby5wKjw1HCRx7p9sVMOWGzb/vA1hwiWc6jm3MvQDTogQkiqIhJV0nBQBTU+3okKCFDy9WwferkHjtxib7t3xIUQtHxnIwtx4mpg26/HfwVNVDb4oI9RHmx5WGelRVlrtiw43zboCLaxv46AZeB3IlTkwouebTr1y2NjSpHz68WNFjHvupy3q8TFn3Hos2IAk4Ju5dCo8B3wP7VPr/FGaKiG+T+v+TQqIrOqMTL1VdWV1DdmcbO8KXBz6esmYWYKPwDL5b5FA1a0hwapHiom0r/cKaoqr+27/XcrS5UwSMbQAAAABJRU5ErkJggg==)](https://deepwiki.com/aquaproj/aqua-installer) [![GitHub last commit](https://img.shields.io/github/last-commit/aquaproj/aqua-installer.svg)](https://github.com/aquaproj/aqua-installer) 4 | [![License](http://img.shields.io/badge/license-mit-blue.svg?style=flat-square)](https://raw.githubusercontent.com/aquaproj/aqua-installer/main/LICENSE) 5 | 6 | Install [aqua](https://aquaproj.github.io/) quickly. 7 | 8 | ## Document 9 | 10 | Please see [document](https://aquaproj.github.io/docs/products/aqua-installer). 11 | 12 | ## License 13 | 14 | [MIT](LICENSE) 15 | -------------------------------------------------------------------------------- /action.yaml: -------------------------------------------------------------------------------- 1 | name: Install aqua 2 | description: Install aqua https://aquaproj.github.io/ and install tools with aqua 3 | inputs: 4 | aqua_version: 5 | description: Installed aqua's version (e.g. v0.8.7) 6 | required: true 7 | github_token: 8 | description: GitHub access token 9 | required: false 10 | default: ${{ github.token }} 11 | enable_aqua_install: 12 | required: false 13 | default: "true" 14 | description: Whether "aqua i" command is run. 15 | aqua_opts: 16 | required: false 17 | default: "-l" 18 | description: Command line options for "aqua i" 19 | policy_allow: 20 | required: false 21 | description: | 22 | aqua >= v2.3.0 23 | If this isn't empty, "aqua policy allow" is run. 24 | If this is "true", "aqua policy allow" is run without argument. 25 | If this isn't empty and isn't "true", "aqua policy allow " is run. 26 | 27 | skip_install_aqua: 28 | required: false 29 | default: "false" 30 | description: If this true and aqua is already installed, installing aqua is skipped. 31 | 32 | working_directory: 33 | required: false 34 | default: "" 35 | description: The working directory to run aqua commands 36 | runs: 37 | using: composite 38 | steps: 39 | - run: | 40 | echo "::error ::aqua_version is required. https://github.com/aquaproj/aqua-installer" 41 | exit 1 42 | shell: bash 43 | if: inputs.aqua_version == '' 44 | 45 | - run: echo "${AQUA_ROOT_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/aquaproj-aqua}/bin" >> $GITHUB_PATH 46 | shell: bash 47 | working-directory: ${{ inputs.working_directory }} 48 | if: runner.os != 'Windows' 49 | 50 | - run: | 51 | echo "${AQUA_ROOT_DIR:-$HOME/AppData/Local/aquaproj-aqua}/bin" >> $GITHUB_PATH 52 | shell: bash 53 | working-directory: ${{ inputs.working_directory }} 54 | if: runner.os == 'Windows' 55 | 56 | - run: | 57 | $(if($env:AQUA_ROOT_DIR) {echo $env:AQUA_ROOT_DIR} else {echo "$HOME/AppData/Local/aquaproj-aqua/bin"}) | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append 58 | shell: pwsh 59 | working-directory: ${{ inputs.working_directory }} 60 | if: runner.os == 'Windows' 61 | 62 | - run: | 63 | if [ "${SKIP_INSTALL_AQUA:-}" = true ] && command -v aqua >/dev/null; then 64 | echo "[INFO] Installing aqua is skipped" >&2 65 | exit 0 66 | fi 67 | "${GITHUB_ACTION_PATH}/aqua-installer" -v "$AQUA_VERSION" 68 | working-directory: ${{ inputs.working_directory }} 69 | shell: bash 70 | env: 71 | AQUA_VERSION: ${{ inputs.aqua_version }} 72 | SKIP_INSTALL_AQUA: ${{ inputs.skip_install_aqua }} 73 | GITHUB_TOKEN: ${{ inputs.github_token }} 74 | 75 | - run: aqua policy allow 76 | working-directory: ${{ inputs.working_directory }} 77 | if: inputs.policy_allow == 'true' 78 | shell: bash 79 | 80 | - run: aqua policy allow "$POLICY_FILE" 81 | working-directory: ${{ inputs.working_directory }} 82 | if: | 83 | inputs.policy_allow != 'true' && inputs.policy_allow != '' 84 | shell: bash 85 | env: 86 | POLICY_FILE: ${{ inputs.policy_allow }} 87 | 88 | - run: aqua i $AQUA_OPTS 89 | if: inputs.enable_aqua_install == 'true' 90 | working-directory: ${{ inputs.working_directory }} 91 | shell: bash 92 | env: 93 | AQUA_OPTS: ${{ inputs.aqua_opts }} 94 | GITHUB_TOKEN: ${{ inputs.github_token }} 95 | -------------------------------------------------------------------------------- /aqua-installer: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # aqua-installer - shell script to install aqua 3 | # https://github.com/aquaproj/aqua-installer 4 | 5 | set -eu 6 | set -o pipefail || : 7 | 8 | usage_exit() { 9 | echo "Usage: $0 [-v version]" 1>&2 10 | exit 1 11 | } 12 | 13 | uname_os() { 14 | local os 15 | os=$(uname -s | tr '[:upper:]' '[:lower:]') 16 | case "$os" in 17 | cygwin_nt*) os="windows" ;; 18 | mingw*) os="windows" ;; 19 | msys_nt*) os="windows" ;; 20 | esac 21 | echo "$os" 22 | } 23 | 24 | uname_arch() { 25 | local arch 26 | arch=$(uname -m) 27 | case $arch in 28 | x86_64) arch="amd64" ;; 29 | aarch64) arch="arm64" ;; 30 | esac 31 | echo "${arch}" 32 | } 33 | 34 | OS="$(uname_os)" 35 | ARCH="$(uname_arch)" 36 | 37 | install_path=${AQUA_ROOT_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/aquaproj-aqua}/bin/aqua 38 | if [ "$OS" = windows ]; then 39 | install_path=${AQUA_ROOT_DIR:-$HOME/AppData/Local/aquaproj-aqua}/bin/aqua.exe 40 | fi 41 | 42 | while getopts v: OPT 43 | do 44 | case $OPT in 45 | v) AQUA_VERSION=$OPTARG 46 | ;; 47 | \?) usage_exit 48 | ;; 49 | esac 50 | done 51 | 52 | shift $((OPTIND - 1)) 53 | 54 | bootstrap_version=v2.55.1 55 | checksums="814bd2ba3b1db409e89eae126ad280413e4edfefe91f598ce173c3b21ba56ca8 aqua_darwin_amd64.tar.gz 56 | cdaa13dd96187622ef5bee52867c46d4cf10765963423dc8e867c7c4decccf4d aqua_darwin_arm64.tar.gz 57 | 7371b9785e07c429608a21e4d5b17dafe6780dabe306ec9f4be842ea754de48a aqua_linux_amd64.tar.gz 58 | 283e0e274af47ff1d4d660a19e8084ae4b6aca23d901e95728a68a63dfb98c87 aqua_linux_arm64.tar.gz 59 | 3efa0eaecd4f252f9dcf0d3b723e77894657977dc91939aac7697380a3f476a1 aqua_windows_amd64.zip 60 | faf478d4db6e873ed85365e6864af31bf831317a1736b4ca7f3cf561e3a463ec aqua_windows_arm64.zip" 61 | 62 | filename=aqua_${OS}_${ARCH}.tar.gz 63 | if [ "$OS" = windows ]; then 64 | filename=aqua_${OS}_${ARCH}.zip 65 | fi 66 | URL=https://github.com/aquaproj/aqua/releases/download/$bootstrap_version/$filename 67 | 68 | tempdir=$(mktemp -d) 69 | echo "[INFO] Installing aqua $bootstrap_version for bootstrapping..." >&2 70 | echo "[INFO] Downloading $URL ..." >&2 71 | if command -v curl > /dev/null 2>&1; then 72 | curl --retry 5 --fail -L "$URL" -o "$tempdir/$filename" 73 | elif command -v wget > /dev/null 2>&1; then 74 | wget -P "$tempdir" "$URL" 75 | else 76 | echo "[ERROR] Neither curl nor wget is found. Please install either curl or wget to download aqua" >&2 77 | exit 1 78 | fi 79 | 80 | cd "$tempdir" 81 | 82 | echo "[INFO] Verifying checksum of aqua $bootstrap_version ..." >&2 83 | if command -v sha256sum > /dev/null 2>&1; then 84 | echo "$checksums" | grep "$filename" | sha256sum -c - 85 | elif command -v shasum > /dev/null 2>&1; then 86 | echo "$checksums" | grep "$filename" | shasum -a 256 -c 87 | else 88 | echo "[WARN] Skipped checksum verification of aqua $bootstrap_version because both sha256sum and shasum commands aren't found" >&2 89 | fi 90 | 91 | if [ "$OS" = windows ]; then 92 | unzip "$filename" > /dev/null 93 | else 94 | tar xvzf "$filename" > /dev/null 95 | fi 96 | chmod a+x aqua 97 | if [ -n "${AQUA_VERSION:-}" ]; then 98 | echo "[INFO] $tempdir/aqua update-aqua $AQUA_VERSION" >&2 99 | ./aqua update-aqua "$AQUA_VERSION" 100 | else 101 | echo "[INFO] $tempdir/aqua update-aqua" >&2 102 | ./aqua update-aqua 103 | fi 104 | 105 | echo "" 106 | echo "===============================================================" 107 | echo "[INFO] aqua is installed into $install_path" >&2 108 | echo '[INFO] Please add the path to the environment variable "PATH"' >&2 109 | # shellcheck disable=SC2016 110 | install_dir='${AQUA_ROOT_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/aquaproj-aqua}/bin' 111 | if [ "$OS" = windows ]; then 112 | # shellcheck disable=SC2016 113 | install_dir='${AQUA_ROOT_DIR:-$HOME/AppData/Local/aquaproj-aqua}/bin' 114 | fi 115 | echo "[INFO] export PATH=$install_dir:\$PATH" >&2 116 | echo "===============================================================" 117 | echo "" 118 | 119 | "$install_path" -v 120 | 121 | rm -R "$tempdir" 122 | --------------------------------------------------------------------------------