push-xc-admin-frontend-image.yml 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. name: xc_admin_frontend Docker Image
  2. on:
  3. push:
  4. branches: [main]
  5. paths: [governance/xc_admin/**]
  6. permissions:
  7. contents: read
  8. id-token: write
  9. jobs:
  10. xc-admin-image:
  11. runs-on: ubuntu-latest
  12. steps:
  13. - uses: actions/checkout@v2
  14. - name: Set image tag to timestamp and shortened commit hash
  15. run: |
  16. SHORT_HASH=$(echo ${{ github.sha }} | cut -c1-7)
  17. TIMESTAMP=$(date +%s)
  18. echo "IMAGE_TAG=${TIMESTAMP}-${SHORT_HASH}" >> "${GITHUB_ENV}"
  19. - uses: aws-actions/configure-aws-credentials@8a84b07f2009032ade05a88a28750d733cc30db1
  20. with:
  21. role-to-assume: arn:aws:iam::192824654885:role/github-actions-ecr
  22. aws-region: eu-west-2
  23. - uses: aws-actions/amazon-ecr-login@v1
  24. id: ecr_login
  25. - name: Build docker image
  26. run: |
  27. DOCKER_BUILDKIT=1 docker build -t lerna -f Dockerfile.lerna .
  28. DOCKER_BUILDKIT=1 docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -f governance/xc_admin/packages/xc_admin_frontend/Dockerfile .
  29. env:
  30. ECR_REGISTRY: ${{ steps.ecr_login.outputs.registry }}
  31. ECR_REPOSITORY: xc-admin-frontend
  32. - name: Push docker image
  33. if: github.ref == 'refs/heads/main'
  34. run: |
  35. docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
  36. env:
  37. ECR_REGISTRY: ${{ steps.ecr_login.outputs.registry }}
  38. ECR_REPOSITORY: xc-admin-frontend