name: docker-build-push on: push: branches: [master] release: types: [published, edited] jobs: docker: runs-on: ubuntu-latest steps: - name: Set up QEMU uses: docker/setup-qemu-action@v1 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 - name: Login to DockerHub uses: docker/login-action@v1 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Print event_name run: echo "$GITHUB_EVENT_NAME, ${{ github.event_name }}, ${{ github.event.release.tag_name }}" - name: Publish master to Dockerhub uses: docker/build-push-action@v2 with: push: true tags: ${{ secrets.DOCKERHUB_USERNAME }}/idrlnet:latest file: Dockerfile - name: Get release version if: github.event_name == 'release' id: get_version run: echo "::set-output name=RELEASE_VERSION::${{ github.event.release.tag_name }}" - name: Publish Releases to Dockerhub if: github.event_name == 'release' uses: docker/build-push-action@v2 with: push: true tags: ${{ secrets.DOCKERHUB_USERNAME }}/idrlnet:${{ steps.get_version.outputs.RELEASE_VERSION }} file: Dockerfile