docker-price-pusher.yml 1.8 KB

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