Initial commit
This commit is contained in:
parent
0d1b82b950
commit
f61ca892bf
8
.editorconfig
Normal file
8
.editorconfig
Normal file
@ -0,0 +1,8 @@
|
||||
# Unix-style newlines with a newline ending every file
|
||||
[*]
|
||||
end_of_line = lf
|
||||
indent_style = space
|
||||
|
||||
[*.{js,jsx,ts,tsx,py,sh,md,gql,graphql,yaml,yml,json,sql,njk,scss,css}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
8
Dockerfile
Normal file
8
Dockerfile
Normal file
@ -0,0 +1,8 @@
|
||||
# Container image that runs your code
|
||||
FROM amazon/aws-cli:2.23.8
|
||||
|
||||
# Copies your code file from your action repository to the filesystem path `/` of the container
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
|
||||
# Code file to execute when the docker container starts up (`entrypoint.sh`)
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
51
README.md
51
README.md
@ -1,2 +1,51 @@
|
||||
# aws-cli-action
|
||||
# AWS Command Line Interface GitHub Action
|
||||
|
||||
## References
|
||||
|
||||
* https://github.com/jakejarvis/s3-sync-action
|
||||
* https://github.com/keithweaver/aws-s3-github-action
|
||||
|
||||
## Creating new releases
|
||||
|
||||
```
|
||||
git add -A;
|
||||
git commit -m "<commit msg>"
|
||||
git tag -a -m "<tag msg>" v1.3
|
||||
git push --follow-tags
|
||||
```
|
||||
|
||||
## Description
|
||||
|
||||
This GitHub Action uses the latest version of the AWS CLI in a Docker container to provide an environment to execute AWS CLI commands. It's designed to enable seamless interaction with AWS services, making it easier to manage AWS resources, deploy applications, and automate workflows directly from your GitHub workflows.
|
||||
|
||||
## Usage
|
||||
|
||||
You can use this action in your GitHub workflows by including it as a step in your workflow file. Below is an example of how to use this action to run a simple AWS CLI command:
|
||||
|
||||
```yaml
|
||||
name: Example S3 Copy Command
|
||||
run-name: example-s3-copy-command
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
|
||||
push:
|
||||
branches: [ main ]
|
||||
|
||||
jobs:
|
||||
aws_cli_:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: AWS CLI Command
|
||||
uses: sahil87/aws-cli-action@v1.3
|
||||
#OR sahil87/aws-cli-action@main
|
||||
with:
|
||||
args: >
|
||||
s3 cp \
|
||||
--recursive \
|
||||
${{ env.cp_source }} ${{ env.cp_destination }}
|
||||
|
||||
21
action.yaml
Normal file
21
action.yaml
Normal file
@ -0,0 +1,21 @@
|
||||
name: 'AWS Command Line Interface'
|
||||
description: 'GitHub Action with the latest AWS CLI in Docker, enabling execution of AWS CLI commands.'
|
||||
branding:
|
||||
icon: "terminal"
|
||||
color: 'orange'
|
||||
|
||||
# inputs:
|
||||
# aws_default_region:
|
||||
# description: 'AWS Default Region'
|
||||
# required: true
|
||||
# aws_acces_key_id:
|
||||
# description: 'AWS Access Key ID'
|
||||
# required: true
|
||||
# aws_secret_access_key:
|
||||
# description: 'AWS Secret Access Key'
|
||||
# required: true
|
||||
|
||||
runs:
|
||||
using: 'docker'
|
||||
image: Dockerfile
|
||||
# image: 'docker://amazon/aws-cli:2.23.8'
|
||||
42
entrypoint.sh
Executable file
42
entrypoint.sh
Executable file
@ -0,0 +1,42 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
if [ -z "$AWS_ACCESS_KEY_ID" ]; then
|
||||
echo "AWS_ACCESS_KEY_ID is not set. Quitting."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$AWS_SECRET_ACCESS_KEY" ]; then
|
||||
echo "AWS_SECRET_ACCESS_KEY is not set. Quitting."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Default to us-east-1 if AWS_DEFAULT_REGION not set.
|
||||
if [ -z "$AWS_DEFAULT_REGION" ]; then
|
||||
AWS_DEFAULT_REGION="us-east-1"
|
||||
fi
|
||||
|
||||
# Create a dedicated profile for this action to avoid conflicts
|
||||
# with past/future actions.
|
||||
# https://github.com/jakejarvis/s3-sync-action/issues/1
|
||||
aws configure --profile s3-sync-action <<-EOF > /dev/null 2>&1
|
||||
${AWS_ACCESS_KEY_ID}
|
||||
${AWS_SECRET_ACCESS_KEY}
|
||||
${AWS_DEFAULT_REGION}
|
||||
text
|
||||
EOF
|
||||
|
||||
echo "aws $*"
|
||||
sh -c "aws $*"
|
||||
|
||||
# Clear out credentials after we're done.
|
||||
# We need to re-run `aws configure` with bogus input instead of
|
||||
# deleting ~/.aws in case there are other credentials living there.
|
||||
# https://forums.aws.amazon.com/thread.jspa?threadID=148833
|
||||
aws configure --profile s3-sync-action <<-EOF > /dev/null 2>&1
|
||||
null
|
||||
null
|
||||
null
|
||||
text
|
||||
EOF
|
||||
Loading…
x
Reference in New Issue
Block a user