Build and Push Images #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: Build and Push Images | |
on: | |
workflow_dispatch: | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
build: | |
name: Build Launch Images | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Set output | |
id: release_tag | |
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT | |
- name: configure aws credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: ${{secrets.AWS_ARN }} | |
role-session-name: GitHub_to_AWS_via_FederatedOIDC | |
aws-region: us-east-1 | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: Build, tag, and push image to Amazon ECR | |
env: | |
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | |
ECR_REPOSITORY: zt-launch-app-images | |
IMAGE_TAG: "${{ steps.release_tag.outputs.tag }}" | |
run: | | |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:zero-true-$IMAGE_TAG . | |
docker push $ECR_REGISTRY/$ECR_REPOSITORY:zero-true-$IMAGE_TAG |