diff --git a/.github/build-push.yml b/.github/build-push.yml new file mode 100644 index 0000000000..a2d9ff285e --- /dev/null +++ b/.github/build-push.yml @@ -0,0 +1,37 @@ +name: build docker image & push to reg + +on: + pull_request: + types: [closed] + branches: [master] + paths: ["**"] + +jobs: + build-and-push: + if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'CI:Build') + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Log in to DockerHub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: prep tags + id: vars + run: | + echo "COMMIT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV + echo "IMAGE_NAME=${{ secrets.DOCKERHUB_USERNAME }}/geth-dev" >> $GITHUB_ENV + + - name: build image + run: | + docker build -t $IMAGE_NAME:latest -t $IMAGE_NAME:$COMMIT_SHA . + + - name: push image + run: | + docker push $IMAGE_NAME:latest + docker push $IMAGE_NAME:$COMMIT_SHA