name: Docker builds on: push: branches: [master] tags: - v* pull_request: branches: [master] env: IS_PUSHING_IMAGES: ${{ github.event_name != 'pull_request' && github.repository == 'photoview/photoview' }} DOCKER_USERNAME: viktorstrate DOCKER_IMAGE: viktorstrate/photoview DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} PLATFORMS: linux/amd64,linux/arm64,linux/arm/v7 jobs: build: name: Build Docker Image runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Set up QEMU uses: docker/setup-qemu-action@v3 with: platforms: ${{ env.PLATFORMS }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Docker Login if: ${{ env.IS_PUSHING_IMAGES == 'true' }} uses: docker/login-action@v3 with: username: ${{ env.DOCKER_USERNAME }} password: ${{ env.DOCKER_PASSWORD }} - name: Docker meta id: docker_meta uses: docker/metadata-action@v5 with: # list of Docker images to use as base name for tags images: ${{ env.DOCKER_IMAGE }} # Docker tags based on the following events/attributes tags: | type=schedule type=ref,event=branch type=ref,event=pr type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{major}} type=sha - name: Build and push uses: docker/build-push-action@v6 with: context: . platforms: ${{ env.PLATFORMS }} pull: true push: ${{ env.IS_PUSHING_IMAGES }} tags: ${{ steps.docker_meta.outputs.tags }} labels: ${{ steps.docker_meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max sbom: true provenance: mode=max annotations: ${{ steps.docker_meta.outputs.annotations }} build-args: | VERSION=${{ github.ref_name }} COMMIT_SHA=${{ github.sha }}