fix(actions): never run mirroring and Docker images build on forks #1338
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build images | ||
| on: [push, pull_request] | ||
| env: | ||
| BASE_IMAGE_NAME: openvk | ||
| jobs: | ||
| buildbase: | ||
| name: Build base images | ||
| if: github.repository_owner == 'OpenVK' | ||
| runs-on: ubuntu-latest | ||
| # 'push' runs on inner branches, 'pull_request' will run only on outer PRs | ||
| if: > | ||
| github.event_name == 'push' | ||
| || (github.event_name == 'pull_request' | ||
| && github.event.pull_request.head.repo.full_name != github.repository) | ||
| steps: | ||
| - name: Set up QEMU | ||
| uses: docker/setup-qemu-action@v3 | ||
| - name: Set up Docker Buildx | ||
| id: buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
| with: | ||
| platforms: linux/amd64,linux/arm64 | ||
| - name: Change repository string to lowercase | ||
| id: repositorystring | ||
| uses: Entepotenz/change-string-case-action-min-dependencies@v1.1.0 | ||
| with: | ||
| string: ${{ github.repository }} | ||
| - name: Base image meta | ||
| id: basemeta | ||
| uses: docker/metadata-action@v5 | ||
| with: | ||
| images: | | ||
| ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/${{env.BASE_IMAGE_NAME}} | ||
| labels: | | ||
| org.opencontainers.image.documentation=https://github.com/OpenVK/openvk/blob/master/install/automated/docker/Readme.md | ||
| tags: | | ||
| type=sha | ||
| type=ref,event=branch | ||
| type=ref,event=pr | ||
| type=ref,event=tag | ||
| type=raw,value=latest,enable={{is_default_branch}} | ||
| - name: Log into registry | ||
| if: github.event_name != 'pull_request' | ||
| run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | ||
| - name: Build base image | ||
| uses: docker/build-push-action@v6 | ||
| with: | ||
| platforms: linux/amd64,linux/arm64 | ||
| file: install/automated/docker/openvk.Dockerfile | ||
| tags: ${{ steps.basemeta.outputs.tags }} | ||
| labels: ${{ steps.basemeta.outputs.labels }} | ||
| push: ${{ github.event_name != 'pull_request' }} | ||
| build-args: | | ||
| GITREPO=${{ steps.repositorystring.outputs.lowercase }} | ||