Skip to content

docker: don't push on a Pull Request #741

docker: don't push on a Pull Request

docker: don't push on a Pull Request #741

# Based on https://github.com/matrix-org/dendrite/blob/master/.github/workflows/docker-hub.yml
name: "Docker Hub - Latest"
on:
push:
branches: ["develop", "release-*"]
pull_request:
env:
DOCKER_NAMESPACE: matrixdotorg
PLATFORMS: linux/amd64
# Only push if this is develop, otherwise we just want to build
# On a PR github.ref is the target branch, so don't push for that either
PUSH: ${{ github.ref == 'refs/heads/develop' && github.event_name != 'pull_request' }}
jobs:
docker-latest:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Login to Docker Hub
uses: docker/login-action@v2
if: ${{ env.PUSH }}
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Build image
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
platforms: ${{ env.PLATFORMS }}
push: ${{ env.PUSH }}
tags: |
${{ env.DOCKER_NAMESPACE }}/matrix-appservice-irc:latest