Push to AWS ECR #6
Workflow file for this run
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: Push to AWS ECR | |
on: | |
workflow_dispatch: | |
inputs: | |
image-tag: | |
required: true | |
type: string | |
description: 'The image tag' | |
jobs: | |
ci: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3.3.0 | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 7.0.x | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --no-restore --configuration Release | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-region: eu-central-1 | |
role-to-assume: ${{ secrets.ROLE_TO_ASSUME_ARN }} | |
role-session-name: ${{ secrets.AWS_OWNER }}-session | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- run: echo ${{ steps.login-ecr.outputs.registry }} | |
- name: Build, tag, and push image to Amazon ECR | |
env: | |
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | |
ECR_REPOSITORY: ${{ secrets.ECR_REPOSITORY_NAME }} | |
IMAGE_TAG: ${{ github.event.inputs.image-tag }} | |
run: | | |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -f AwsIntegration/Dockerfile . | |
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG |