docker-hermes.yml 1.6 KB

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