hermes-image-push.yml 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. name: Build and Push Hermes Image
  2. on:
  3. push:
  4. tags:
  5. - hermes-v*
  6. workflow_dispatch:
  7. inputs:
  8. dispatch_description:
  9. description: "Dispatch description"
  10. required: true
  11. type: string
  12. permissions:
  13. contents: read
  14. id-token: write
  15. jobs:
  16. hermes-image:
  17. runs-on: ubuntu-latest
  18. steps:
  19. - uses: actions/checkout@v2
  20. - name: Set image tag to version of the git tag
  21. if: ${{ startsWith(github.ref, 'refs/tags/hermes-v') }}
  22. run: |
  23. PREFIX="refs/tags/hermes-"
  24. VERSION="${GITHUB_REF:${#PREFIX}}"
  25. echo "IMAGE_TAG=${VERSION}" >> "${GITHUB_ENV}"
  26. - name: Set image tag to the git commit hash
  27. if: ${{ !startsWith(github.ref, 'refs/tags/hermes-v') }}
  28. run: |
  29. echo "IMAGE_TAG=${{ github.sha }}" >> "${GITHUB_ENV}"
  30. - uses: aws-actions/configure-aws-credentials@8a84b07f2009032ade05a88a28750d733cc30db1
  31. with:
  32. role-to-assume: arn:aws:iam::192824654885:role/github-actions-ecr
  33. aws-region: eu-west-2
  34. - uses: docker/login-action@v2
  35. with:
  36. registry: public.ecr.aws
  37. env:
  38. AWS_REGION: us-east-1
  39. - run: |
  40. DOCKER_BUILDKIT=1 docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -f hermes/Dockerfile .
  41. docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
  42. env:
  43. ECR_REGISTRY: public.ecr.aws
  44. ECR_REPOSITORY: pyth-network/hermes