Skip to content

Bump aws-actions/configure-aws-credentials from 1 to 4 #1153

Bump aws-actions/configure-aws-credentials from 1 to 4

Bump aws-actions/configure-aws-credentials from 1 to 4 #1153

name: "Proxy - Resource"
on:
push:
paths:
- "sourcecode/proxies/resource/**"
- ".github/workflows/proxy-resource.yaml"
workflow_call:
inputs:
versionToRelease:
description: 'A version to release'
required: true
type: string
secrets:
AWS_DOCKER_REGISTRY_ACCESS_KEY_ID:
required: true
AWS_DOCKER_REGISTRY_SECRET_ACCESS_KEY:
required: true
env:
workingDirectory: sourcecode/proxies/resource
shouldPublishImage: ${{ inputs.versionToRelease && '1' || '0' }}
jobs:
test_and_release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build test image
uses: docker/build-push-action@v4
with:
tags: "test:latest"
outputs: "type=docker"
context: ${{ env.workingDirectory }}
target: test
cache-from: type=gha
cache-to: type=gha,mode=max
- name: "Run tests"
run: docker run test
shell: bash
- name: Configure AWS Credentials
if: env.shouldPublishImage == '1'
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_DOCKER_REGISTRY_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_DOCKER_REGISTRY_SECRET_ACCESS_KEY }}
aws-region: eu-west-1
role-duration-seconds: 3600
role-session-name: GithubCerpusPushImage
- name: Login to AWS docker registry
if: env.shouldPublishImage == '1'
shell: bash
run: aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws
- name: Build and push app
if: env.shouldPublishImage == '1'
id: docker_build_app
uses: docker/build-push-action@v4
with:
push: true
tags: public.ecr.aws/f0t8l9h1/proxy-resource-app:${{ inputs.versionToRelease }}
context: sourcecode/proxies/resource
target: prod
cache-from: type=gha
cache-to: type=gha,mode=max