feat(docker-build-push.yaml): enhance debug output with event name an… #14
This file contains 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 and Push Docker Images | |
on: | |
push: | |
workflow_dispatch: | |
permissions: | |
contents: read | |
packages: write | |
jobs: | |
debug: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Debug | |
run: | | |
echo "Event name: ${{ github.event_name }}" | |
echo "Modified files:" | |
echo "${{ toJson(github.event.push.head_commit.modified) }}" | |
build-and-push-base: | |
if: github.event_name == 'workflow_dispatch' || contains(github.event.push.paths, 'build-base/') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set lowercase repository name | |
run: echo "REPO_LOWERCASE=${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push base image | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./build-base | |
file: ./build-base/Dockerfile | |
push: true | |
tags: ghcr.io/${{ env.REPO_LOWERCASE }}/base:latest | |
platforms: linux/amd64,linux/arm64 | |
build-and-push-grpc-server: | |
needs: build-and-push-base | |
if: | | |
always() && | |
(needs.build-and-push-base.result == 'success' || needs.build-and-push-base.result == 'skipped') && | |
(github.event_name == 'workflow_dispatch' || contains(github.event.push.paths, 'build-base/') || contains(github.event.push.paths, 'api/') || contains(github.event.push.paths, 'solver/')) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set lowercase repository name | |
run: echo "REPO_LOWERCASE=${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push grpc-server image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: ./api/Dockerfile | |
push: true | |
tags: ghcr.io/${{ env.REPO_LOWERCASE }}/grpc-server:latest | |
platforms: linux/amd64,linux/arm64 | |
build-and-push-envoy: | |
if: github.event_name == 'workflow_dispatch' || contains(github.event.push.paths, 'envoy/') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set lowercase repository name | |
run: echo "REPO_LOWERCASE=${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push envoy image | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./envoy | |
file: ./envoy/Dockerfile | |
push: true | |
tags: ghcr.io/${{ env.REPO_LOWERCASE }}/envoy:latest | |
platforms: linux/amd64,linux/arm64 | |
build-and-push-frontend: | |
if: github.event_name == 'workflow_dispatch' || contains(github.event.push.paths, 'react-frontend/') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set lowercase repository name | |
run: echo "REPO_LOWERCASE=${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push frontend image | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./react-frontend | |
file: ./react-frontend/Dockerfile | |
push: true | |
tags: ghcr.io/${{ env.REPO_LOWERCASE }}/frontend:latest | |
platforms: linux/amd64,linux/arm64 |