docker-entropy-tester.yml 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. name: Build and Push Entropy Tester Image
  2. on:
  3. push:
  4. tags:
  5. - entropy-tester-v*
  6. pull_request:
  7. paths:
  8. - "apps/entropy-tester/**"
  9. - ".github/workflows/docker-entropy-tester.yml"
  10. - "Dockerfile.node"
  11. workflow_dispatch:
  12. inputs:
  13. dispatch_description:
  14. description: "Dispatch description"
  15. required: true
  16. type: string
  17. permissions:
  18. contents: read
  19. id-token: write
  20. packages: write
  21. env:
  22. REGISTRY: ghcr.io
  23. IMAGE_NAME: pyth-network/entropy-tester
  24. jobs:
  25. entropy-tester-image:
  26. runs-on: ubuntu-latest
  27. steps:
  28. - uses: actions/checkout@v2
  29. - name: Set image tag to version of the git tag
  30. if: ${{ startsWith(github.ref, 'refs/tags/entropy-tester-v') }}
  31. run: |
  32. PREFIX="refs/tags/entropy-tester-"
  33. VERSION="${GITHUB_REF:${#PREFIX}}"
  34. echo "IMAGE_TAG=${VERSION}" >> "${GITHUB_ENV}"
  35. - name: Set image tag to the git commit hash
  36. if: ${{ !startsWith(github.ref, 'refs/tags/entropy-tester-v') }}
  37. run: |
  38. echo "IMAGE_TAG=${{ github.sha }}" >> "${GITHUB_ENV}"
  39. - name: Log in to the Container registry
  40. uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
  41. with:
  42. registry: ${{ env.REGISTRY }}
  43. username: ${{ github.actor }}
  44. password: ${{ secrets.GITHUB_TOKEN }}
  45. - name: Build docker image
  46. run: |
  47. DOCKER_BUILDKIT=1 docker build --build-arg package="@pythnetwork/entropy-tester" -t ${{ env.REGISTRY }}/pyth-network/entropy-tester:${{ env.IMAGE_TAG }} -f Dockerfile.node .
  48. - name: Push docker image
  49. run: |
  50. docker push ${{ env.REGISTRY }}/pyth-network/entropy-tester:${{ env.IMAGE_TAG }}