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

feat: create env vars from AWS secrets #16

Merged
merged 6 commits into from
Apr 9, 2024
Merged
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
20 changes: 20 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ inputs:
required: false
description: 'The checkout depth. Set to 0 to have a full checkout'
default: '1'
load-secrets:
required: false
description: 'Load secrets from AWS secrets manager as environment variables'
default: 'false'
secret-names:
required: false
description: 'The names of the secrets to pull values from'
default: ''

outputs:
ecr-repo-name:
Expand All @@ -51,15 +59,26 @@ runs:
with:
persist-credentials: false
fetch-depth: ${{ inputs.checkout-depth }}

- name: Configure AWS credentials
uses: aws-actions/[email protected]
with:
role-to-assume: ${{ inputs.role-to-assume }}
role-session-name: ${{ inputs.role-session-name }}
aws-region: ${{ inputs.aws-region }}

- name: Load AWS Secrets
id: load-secrets
if: ${{ inputs.load-secrets == 'true' }}
uses: aws-actions/aws-secretsmanager-get-secrets@v2
with:
secret-ids: ${{ inputs.secret-names }}
parse-json-secrets: true

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2

- name: Image Name
id: img-name
shell: bash
Expand All @@ -69,6 +88,7 @@ runs:
else
echo "ecr-repo-name=${{inputs.aws-account-id}}.dkr.ecr.${{ inputs.aws-region }}.amazonaws.com/image/${{ inputs.ecr-repo-name }}" >>"${GITHUB_OUTPUT}"
fi

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
Expand Down