Merge pull request #269 from OCHA-DAP/feature/HDX-10326-add-start-end… #250
Workflow file for this run
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: Create image | |
on: | |
push: | |
branches: | |
- dev | |
- main | |
- prod | |
tags: [ '*' ] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
id: checkout | |
uses: actions/checkout@v2 | |
- name: Tag Info | |
id: tag_info | |
run: | | |
export IMAGE_TAG="${GITHUB_REF#refs/*/}" | |
export IMAGE_TAG=${IMAGE_TAG//[^[:alnum:].-]/-} | |
echo ::set-output name=IMAGE_TAG::$([[ "$GITHUB_EVENT_NAME" == "workflow_dispatch" ]] && echo "$GITHUB_SHA" || echo "$IMAGE_TAG") | |
- name: Show image tag | |
run: | | |
echo "Image tag is ${{ steps.tag_info.outputs.IMAGE_TAG }}" | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: arm64 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-access-key-id: ${{ secrets.ECR_AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.ECR_AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-east-1 | |
- name: Login to Public ECR | |
uses: docker/login-action@v2 | |
with: | |
registry: public.ecr.aws | |
username: ${{ secrets.ECR_AWS_ACCESS_KEY_ID }} | |
password: ${{ secrets.ECR_AWS_SECRET_ACCESS_KEY }} | |
env: | |
AWS_REGION: us-east-1 | |
- name: Build, tag, and push image to Amazon ECR | |
uses: docker/build-push-action@v4 | |
with: | |
push: true | |
tags: public.ecr.aws/unocha/hdx-hapi:${{ steps.tag_info.outputs.IMAGE_TAG }} | |
platforms: linux/amd64,linux/arm64 |