name: ACTIONet-py-release
on:
  push:
    branches:
      - 'python-release'
jobs:
  main:
    runs-on: ubuntu-latest
    timeout-minutes: 3000
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Set up QEMU
        uses: docker/setup-qemu-action@v1
      - name: Check file existence
        id: check_buildx_existence
        uses: andstor/file-existence-action@v1
        with:
          files: "/home/ubuntu/.docker/cli-plugins/docker-buildx"
      - name: Set up Docker Buildx
        if: steps.check_buildx_existence.outputs.file_exists == 'false'
        id: buildx
        uses: docker/setup-buildx-action@v1
        with:
          version: latest
          driver-opts: network=host
      - name: Login to DockerHub Registry
        run: echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
      - name: Build and push latest docker
        uses: docker/build-push-action@v2
        with:
          context: .
          file: ./Dockerfile
          push: true
          build-args: GITHUB_PAT=${{ secrets.GITHUB_TOKEN }}
          tags: actionet/python_release:latest
