Skip to content

Commit

Permalink
store condition in variable
Browse files Browse the repository at this point in the history
  • Loading branch information
taraspos committed Sep 6, 2024
1 parent c90e6fb commit fc798c5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
env:
AWS_REGION_PUBLIC: us-east-1
AWS_ROLE: arn:aws:iam::146628656107:role/cert-manager-controller-github-action-ecr-role
DRY_RUN: ${{ !(startsWith(github.ref, 'refs/tags/v') && contains(github.ref, 'teleport')) }}
permissions:
contents: read
id-token: write # This is required for requesting the JWT, see https://github.com/aws-actions/configure-aws-credentials#OIDC
Expand All @@ -47,14 +48,14 @@ jobs:
with:
aws-region: ${{ env.AWS_REGION_PUBLIC }}
role-to-assume: ${{ env.AWS_ROLE }}
if: &push_condition ${{ startsWith(github.ref, 'refs/tags/v') && contains(github.ref, 'teleport') }}
if: ${{ env.DRY_RUN }}

- name: Login to Amazon ECR Public
id: login-ecr-public
uses: aws-actions/amazon-ecr-login@062b18b96a7aff071d4dc91bc00c4c1a7945b076 # v2
with:
registry-type: public
if: *push_condition
if: ${{ env.DRY_RUN }}

- name: Prepare docker labels and tags
id: meta
Expand All @@ -71,7 +72,7 @@ jobs:
- name: Build the Docker image and push
uses: docker/build-push-action@5cd11c3a4ced054e52742c5fd54dca954e0edd85 # v6
with:
push: *push_condition
push: ${{ env.DRY_RUN }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
Expand Down

0 comments on commit fc798c5

Please sign in to comment.