Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add arch environment variable #9

Merged
merged 1 commit into from
Nov 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Add the following step to a job in your workflow
with:
version: 2 # default
verbose: false # default
arch: x86 # default
```

### Full example
Expand Down Expand Up @@ -93,4 +94,16 @@ jobs:
version: 2.0.30
- run: aws --version
shell: bash

test_arm:
runs-on: ubuntu-latest
name: arm architecture
steps:
- uses: actions/checkout@v2
- id: install-aws-cli
uses: unfor19/install-aws-cli-action@v1
with:
arch: aarch64
- run: aws --version
shell: bash
```
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ inputs:
description: "Install lightsailctl plugin"
required: false
default: false
arch:
description: Architecture of the linux host
required: false
default: x86
outputs:
version:
description: "The AWS CLI version that was installed"
Expand All @@ -30,6 +34,7 @@ runs:
echo "AWS_CLI_VERSION=${{ inputs.version }}" >> $GITHUB_ENV
echo "VERBOSE=${{ inputs.verbose }}" >> $GITHUB_ENV
echo "LIGHTSAILCTL=${{ inputs.lightsailctl }}" >> $GITHUB_ENV
echo "ARCH=${{ inputs.arch }}" >> $GITHUB_ENV
shell: bash
- id: install-aws-cli
run: sudo --preserve-env ${{ github.action_path }}/entrypoint.sh
Expand Down
10 changes: 9 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ _AWS_CLI_VERSION=${_AWS_CLI_VERSION^^} # All uppercase
_AWS_CLI_VERSION=${_AWS_CLI_VERSION//V/} # Remove "V"
_AWS_CLI_VERSION=${_AWS_CLI_VERSION:-$_DEFAULT_VERSION}
_DOWNLOAD_URL=""
_DEFAULT_ARCH="x86"
_ARCH=${_ARCH^^}
_ARCH=${_ARCH:-$_DEFAULT_ARCH}
_LIGHTSAIL_INSTALL=${LIGHTSAILCTL:-"false"}

msg_error(){
Expand Down Expand Up @@ -59,8 +62,13 @@ valid_semantic_version(){

set_download_url(){
msg_log "Setting _DOWNLOAD_URL"
# If arch is aarch64 provided, bypass version check because:
# 1. Only version 2 is available for aarch64
# 2. Give arch priority over version(if both provided)
if [[ $_ARCH = "AARCH64" ]]; then
_DOWNLOAD_URL = "https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip"
# v1
if [[ $_AWS_CLI_VERSION =~ ^1.*$ ]]; then
elif [[ $_AWS_CLI_VERSION =~ ^1.*$ ]]; then
if [[ $_AWS_CLI_VERSION = "1" ]]; then
_DOWNLOAD_URL="https://s3.amazonaws.com/aws-cli/awscli-bundle.zip"
else
Expand Down