Skip to content

Commit

Permalink
ci; tidy up
Browse files Browse the repository at this point in the history
  • Loading branch information
lachlanhurst committed May 20, 2024
1 parent 8a3503b commit c937e92
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 21 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build-on-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ jobs:
with:
path: server
image-name: ausseabed-staging-sct-api
aws-region: ap-southeast-2
aws-account-id: 288871573946
secrets:
AWS_ACCESS_KEY_ID: ${{ secrets.STAGING_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.STAGING_SECRET_ACCESS_KEY }}
aws-access-key-id: ${{ secrets.STAGING_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.STAGING_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.STAGING_AWS_REGION }}
aws-account-id: ${{ secrets.STAGING_AWS_ACCOUNT_ID }}
28 changes: 11 additions & 17 deletions .github/workflows/build-push-to-ecr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,16 @@ on:
image-name:
required: true
type: string
aws-region:
secrets:
aws-access-key-id:
required: true
type: string
aws-account-id:
aws-secret-access-key:
required: true
type: string
secrets:
AWS_ACCESS_KEY_ID:
aws-region:
required: true
AWS_SECRET_ACCESS_KEY:
aws-account-id:
required: true

env:
AWS_REGION: ${{ inputs.aws-region }}
AWS_ACCOUNT_ID: ${{ inputs.aws-account-id }}

jobs:
build-and-push:
name: Build Docker image and push to ECR
Expand Down Expand Up @@ -71,17 +65,17 @@ jobs:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ inputs.aws-region }}
aws-access-key-id: ${{ secrets.aws-access-key-id }}
aws-secret-access-key: ${{ secrets.aws-secret-access-key }}
aws-region: ${{ secrets.aws-region }}

- name: Login to Amazon ECR
id: login-ecr
run: aws ecr get-login-password --region ${{ inputs.aws-region }} | docker login --username AWS --password-stdin ${{ inputs.aws-account-id }}.dkr.ecr.${{ inputs.aws-region }}.amazonaws.com
run: aws ecr get-login-password --region ${{ secrets.aws-region }} | docker login --username AWS --password-stdin ${{ secrets.aws-account-id }}.dkr.ecr.${{ secrets.aws-region }}.amazonaws.com

- name: Tag and Push Docker image to ECR
env:
NEW_TAG: ${{ steps.tag_docker_image.outputs.NEW_TAG }}
run: |
docker tag ${{ inputs.image-name }}:${NEW_TAG} ${{ inputs.aws-account-id }}.dkr.ecr.${{ inputs.aws-region }}.amazonaws.com/${{ inputs.image-name }}:${NEW_TAG}
docker push ${{ inputs.aws-account-id }}.dkr.ecr.${{ inputs.aws-region }}.amazonaws.com/${{ inputs.image-name }}:${NEW_TAG}
docker tag ${{ inputs.image-name }}:${NEW_TAG} ${{ secrets.aws-account-id }}.dkr.ecr.${{ secrets.aws-region }}.amazonaws.com/${{ inputs.image-name }}:${NEW_TAG}
docker push ${{ secrets.aws-account-id }}.dkr.ecr.${{ secrets.aws-region }}.amazonaws.com/${{ inputs.image-name }}:${NEW_TAG}

0 comments on commit c937e92

Please sign in to comment.