Security secrets #40
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Lambda Docker Image Build and Push" | |
on: | |
pull_request: | |
jobs: | |
Docker: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v2 | |
- | |
name: Configure AWS credentials from Test account | |
uses: aws-actions/configure-aws-credentials@master | |
with: | |
role-to-assume: arn:aws:iam::464004139021:role/GithubActionsRole | |
aws-region: us-east-1 | |
- | |
name: Create and Display ECR Repo | |
run: aws ecr create-repository --repository-name xxxxxxxxx || echo "ECR Repo already exists, skipping command." | |
- | |
name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
with: | |
mask-password: true | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- | |
name: Build and push | |
uses: docker/build-push-action@v5 | |
env: | |
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | |
IMAGE: xxxxxxxxx | |
TAG: latest | |
with: | |
push: true | |
context: code/discordlambda | |
provenance: false | |
tags: ${{ env.ECR_REGISTRY }}/${{ env.IMAGE }}:${{ env.TAG }} |