Move workflows into .github dir as required by spec #1
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: Run command in docker container | |
on: | |
workflow_call: | |
inputs: | |
image-target: | |
description: 'The build step target of the docker image' | |
type: string | |
ecr-image-name: | |
description: 'The build step target of the docker image' | |
default: ${{ github.event.repository.name }} | |
type: string | |
secrets: | |
AWS_ACCOUNT_ID: | |
required: true | |
jobs: | |
push-to-ecr: | |
name: Push docker image to ECR | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Get app version | |
id: get-app-version | |
uses: infoxchange/github-ci/actions/get-app-version | |
- name: Load docker image | |
id: load-docker-image | |
uses: infoxchange/github-ci/actions/setup-docker-image | |
with: | |
target: ${{ inputs.image-target }} | |
build-args: | | |
APP_VERSION=${{ steps.get-app-version.outputs.app-version }} | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-region: ap-southeast-2 | |
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/GithubActionsOIDC | |
role-session-name: github-push-session | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: Push image to ECR | |
env: | |
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | |
run: | | |
docker tag ${{ steps.load-docker-image.outputs.image-name }}:latest $ECR_REGISTRY/${{ inputs.ecr-image-name }}:${{ steps.get-app-version.outputs.app-version }} | |
docker push $ECR_REGISTRY/${{ inputs.ecr-image-name }}:${{ steps.get-app-version.outputs.app-version }} | |
- name: Create image pushed notice | |
run: 'echo "::notice title=Image has been pushed to ECR::Image tag: ${{ steps.get-app-version.outputs.app-version }}"' |