Skip to content

Update hdx-dependency-deploy-config.txt #655

Update hdx-dependency-deploy-config.txt

Update hdx-dependency-deploy-config.txt #655

name: HDX/CKAN create image
on:
push:
branches:
- dev
- prod
- hdx-*
tags: [ '*' ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
id: checkout
uses: actions/checkout@v3
- name: Repo Info
id: repo_info
run: |
export REPO_NAME="${GITHUB_REPOSITORY#*/}"
echo ::set-output name=REPO_NAME::${REPO_NAME}
- 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: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
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@v3
with:
push: true
file: ./Dockerfile
tags: public.ecr.aws/unocha/${{ steps.repo_info.outputs.REPO_NAME }}:${{ steps.tag_info.outputs.IMAGE_TAG }}