Try CI's different conditional on steps #52
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
# Experiments: | |
# [x] Can I read env.IMAGE_NAME? | |
# [x] Can I print git event name? | |
# [x] Can I recognize pull requests? | |
# [] Can I use if conditions for steps? | |
name: Docker CI | |
on: | |
push: | |
branches: try-ci-conditionals | |
paths: | |
- '*.Dockerfile' | |
- '*.Dockerfile.dockerignore' | |
- '.github/workflows/*.yaml' | |
env: | |
REGISTRY: ghcr.io | |
jobs: | |
docker-build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
purpose: [builder, emulator] | |
env: | |
IMAGE_NAME: ghcr.io/${{ github.repository_owner }}/plato-${{ matrix.purpose }} | |
permissions: | |
packages: write | |
contents: read | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: 'true' | |
# Extract metadata (tags, labels) for Docker | |
# https://github.com/docker/metadata-action | |
- name: Extract Docker metadata | |
id: meta | |
if: ${{ github.event_name == 'pull_request' }} | |
run: echo 'Extract Docker metadata' | |
- name: Log into registry ${{ env.REGISTRY }} | |
if: ${{ github.event_name == 'pull_request' }} | |
run: echo 'Log into registry' | |
# Build and push Docker image with Buildx (don't push on PR) | |
# https://github.com/docker/build-push-action | |
- name: Build and push Docker image | |
id: build-and-push | |
run: echo 'Build and push Docker image' | |
- name: Check image layers | |
if: ${{ github.event_name == 'pull_request' }} | |
id: check-layers | |
run: echo 'Check image layers' |