Skip to content

Commit

Permalink
github workflows: update with more generic parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
digorgonzola committed Feb 13, 2024
1 parent 3352689 commit 998454f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@ permissions:
contents: read

env:
app_name: sample-django-app
environment_name: production

jobs:
build_push:
runs-on: ubuntu-latest
environment: production
outputs:
image_digest: ${{ steps.build_and_push.outputs.digest }}
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -29,6 +28,7 @@ jobs:
uses: docker/setup-buildx-action@v3

- name: Configure AWS Credentials
id: aws_auth
uses: aws-actions/configure-aws-credentials@v4
with:
audience: sts.amazonaws.com
Expand All @@ -53,7 +53,7 @@ jobs:
- name: Push Image Digest to SSM
run: |
aws ssm put-parameter \
--name "/apps/sample-django-app/${{ env.environment_name }}/image_digest" \
--name "/apps/${{ env.app_name }}/${{ env.environment_name }}/image_digest" \
--type "String" \
--value "$digest" \
--overwrite
Expand Down Expand Up @@ -86,7 +86,7 @@ jobs:
workflow_id: 'deploy.yml',
ref: 'main',
inputs: {
app_name: 'sample-django-app',
app_name: '${{ env.app_name }}',
environment: '${{ env.environment_name }}'
}
})
12 changes: 7 additions & 5 deletions .github/workflows/build-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@ permissions:
contents: read

env:
app_name: sample-django-app
environment_name: staging

jobs:
build_push:
runs-on: ubuntu-latest
environment: staging
outputs:
image_digest: ${{ steps.build_and_push.outputs.digest }}
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -33,6 +32,7 @@ jobs:
uses: docker/setup-buildx-action@v3

- name: Configure AWS Credentials
id: aws_auth
uses: aws-actions/configure-aws-credentials@v4
with:
audience: sts.amazonaws.com
Expand All @@ -52,12 +52,14 @@ jobs:
# Only building for AMD64 for now
# platforms: linux/amd64,linux/arm64
push: true
tags: ${{ vars.ECR_REGISTRY }}/${{ vars.ECR_REPOSITORY }}:${{ github.sha }}
tags: |
${{ vars.ECR_REGISTRY }}/${{ vars.ECR_REPOSITORY }}:${{ github.sha }}
${{ vars.ECR_REGISTRY }}/${{ vars.ECR_REPOSITORY }}:latest
- name: Push Image Digest to SSM
run: |
aws ssm put-parameter \
--name "/apps/sample-django-app/${{ env.environment_name }}/image_digest" \
--name "/apps/${{ env.app_name }}/${{ env.environment_name }}/image_digest" \
--type "String" \
--value "$digest" \
--overwrite
Expand Down Expand Up @@ -90,7 +92,7 @@ jobs:
workflow_id: 'deploy.yml',
ref: 'main',
inputs: {
app_name: 'sample-django-app',
app_name: '${{ env.app_name }}',
environment: '${{ env.environment_name }}'
}
})
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ on:
- '.github/environment/**'

concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
group: ${{ github.ref }}
cancel-in-progress: true

permissions:
id-token: write
Expand Down

0 comments on commit 998454f

Please sign in to comment.