Skip to content

ci: fix workflows for forks #47

ci: fix workflows for forks

ci: fix workflows for forks #47

name: Build Dev Helper Container Images
on:
pull_request:
paths:
- .github/workflows/build-dev-helper-container-images.yaml
- dev/
jobs:
build-and-push-container:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
image:
- name: caddy-gateway-proxy
containerfile: dev/caddy-gateway-proxy/Dockerfile
context: dev/caddy-gateway-proxy/
- name: mcp-tool-as-server
containerfile: dev/mcp-tool-as-server/Dockerfile
context: dev/mcp-tool-as-server/
- name: oauth-mock
containerfile: dev/oauth-mock/Dockerfile
context: dev/oauth-mock/
steps:
- uses: actions/checkout@v4
- uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/setup-buildx-action@v3
- uses: docker/build-push-action@v6
with:
context: ${{ matrix.image.context }}
file: ${{ matrix.image.containerfile }}
push: true
tags: ghcr.io/${{ github.repository }}/dev-helper/${{ matrix.image.name }}:commit-${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
image-promotion:
runs-on: ubuntu-latest
if: github.ref_name == 'main'
needs: build-and-push-container
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
image:
- name: caddy-gateway-proxy
- name: mcp-tool-as-server
- name: oauth-mock
steps:
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Promote Image
run: |
docker pull ghcr.io/${{ github.repository }}/dev-helper/${{ matrix.image.name }}:commit-${{ github.sha }}
docker tag ghcr.io/${{ github.repository }}/dev-helper/${{ matrix.image.name }}:commit-${{ github.sha }} ghcr.io/${{ github.repository }}/dev-helper/${{ matrix.image.name }}:latest
docker push ghcr.io/${{ github.repository }}/dev-helper/${{ matrix.image.name }}:latest