mirror of
https://github.com/immich-app/immich.git
synced 2025-06-03 13:44:16 -04:00
ci: push images to mich registry when running on forks
This commit is contained in:
parent
b13a98646f
commit
e7b6f20b5b
20
.github/workflows/docker.yml
vendored
20
.github/workflows/docker.yml
vendored
@ -284,12 +284,13 @@ jobs:
|
|||||||
context: .
|
context: .
|
||||||
file: server/Dockerfile
|
file: server/Dockerfile
|
||||||
GHCR_REPO: ghcr.io/${{ github.repository_owner }}/immich-server
|
GHCR_REPO: ghcr.io/${{ github.repository_owner }}/immich-server
|
||||||
|
MICH_REPO: ${{ matrix.runner == 'mich' && 'registry.preview.svc.cluster.local/immich-app/immich-server' || 'registry.immich.cloud/immich-app/immich-server' }}
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- platform: linux/amd64
|
- platform: linux/amd64
|
||||||
runner: ubuntu-latest
|
runner: ${{ github.event.pull_request.head.repo.fork && 'mich' || 'ubuntu-latest' }}
|
||||||
- platform: linux/arm64
|
- platform: linux/arm64
|
||||||
runner: ubuntu-24.04-arm
|
runner: ubuntu-24.04-arm
|
||||||
steps:
|
steps:
|
||||||
@ -342,7 +343,7 @@ jobs:
|
|||||||
cache-from: |
|
cache-from: |
|
||||||
type=registry,ref=${{ env.GHCR_REPO }}-build-cache:${{ env.PLATFORM_PAIR }}-${{ env.CACHE_KEY_SUFFIX }}
|
type=registry,ref=${{ env.GHCR_REPO }}-build-cache:${{ env.PLATFORM_PAIR }}-${{ env.CACHE_KEY_SUFFIX }}
|
||||||
type=registry,ref=${{ env.GHCR_REPO }}-build-cache:${{ env.PLATFORM_PAIR }}-main
|
type=registry,ref=${{ env.GHCR_REPO }}-build-cache:${{ env.PLATFORM_PAIR }}-main
|
||||||
outputs: type=image,"name=${{ env.GHCR_REPO }}",push-by-digest=true,name-canonical=true,push=${{ !github.event.pull_request.head.repo.fork }}
|
outputs: type=image,"name=${{ github.event.pull_request.head.repo.fork && env.MICH_REPO || env.GHCR_REPO }}",push-by-digest=true,name-canonical=true,push=${{ !(github.event.pull_request.head.repo.fork && matrix.runner != 'mich') }}
|
||||||
build-args: |
|
build-args: |
|
||||||
DEVICE=cpu
|
DEVICE=cpu
|
||||||
BUILD_ID=${{ github.run_id }}
|
BUILD_ID=${{ github.run_id }}
|
||||||
@ -358,6 +359,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Upload digest
|
- name: Upload digest
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
|
if: ${{ !(github.event.pull_request.head.repo.fork && matrix.runner != 'mich') }}
|
||||||
with:
|
with:
|
||||||
name: server-digests-${{ env.PLATFORM_PAIR }}
|
name: server-digests-${{ env.PLATFORM_PAIR }}
|
||||||
path: ${{ runner.temp }}/digests/*
|
path: ${{ runner.temp }}/digests/*
|
||||||
@ -366,11 +368,12 @@ jobs:
|
|||||||
|
|
||||||
merge_server:
|
merge_server:
|
||||||
name: Merge & Push Server
|
name: Merge & Push Server
|
||||||
runs-on: ubuntu-latest
|
runs-on: ${{ github.event.pull_request.head.repo.fork && 'mich' || 'ubuntu-latest' }}
|
||||||
if: ${{ needs.pre-job.outputs.should_run_server == 'true' && !github.event.pull_request.head.repo.fork }}
|
if: ${{ needs.pre-job.outputs.should_run_server == 'true' && !github.event.pull_request.head.repo.fork }}
|
||||||
env:
|
env:
|
||||||
GHCR_REPO: ghcr.io/${{ github.repository_owner }}/immich-server
|
GHCR_REPO: ghcr.io/${{ github.repository_owner }}/immich-server
|
||||||
DOCKER_REPO: altran1502/immich-server
|
DOCKER_REPO: altran1502/immich-server
|
||||||
|
MICH_REPO: ${{ matrix.runner == 'mich' && 'registry.preview.svc.cluster.local/immich-app/immich-server' || 'registry.immich.cloud/immich-app/immich-server' }}
|
||||||
needs:
|
needs:
|
||||||
- build_and_push_server
|
- build_and_push_server
|
||||||
steps:
|
steps:
|
||||||
@ -395,6 +398,14 @@ jobs:
|
|||||||
username: ${{ github.repository_owner }}
|
username: ${{ github.repository_owner }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Login to Mich Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
if: ${{ matrix.runner != 'mich' }}
|
||||||
|
with:
|
||||||
|
registry: registry.immich.cloud
|
||||||
|
username: ${{ github.repository_owner }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
@ -407,6 +418,7 @@ jobs:
|
|||||||
latest=false
|
latest=false
|
||||||
images: |
|
images: |
|
||||||
name=${{ env.GHCR_REPO }}
|
name=${{ env.GHCR_REPO }}
|
||||||
|
name=${{ env.MICH_REPO }}
|
||||||
name=${{ env.DOCKER_REPO }},enable=${{ github.event_name == 'release' }}
|
name=${{ env.DOCKER_REPO }},enable=${{ github.event_name == 'release' }}
|
||||||
tags: |
|
tags: |
|
||||||
# Tag with branch name
|
# Tag with branch name
|
||||||
@ -423,7 +435,7 @@ jobs:
|
|||||||
working-directory: ${{ runner.temp }}/digests
|
working-directory: ${{ runner.temp }}/digests
|
||||||
run: |
|
run: |
|
||||||
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
|
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
|
||||||
$(printf '${{ env.GHCR_REPO }}@sha256:%s ' *)
|
$(printf '${{ github.event.pull_request.head.repo.fork && env.MICH_REPO || env.GHCR_REPO }}@sha256:%s ' *)
|
||||||
|
|
||||||
success-check-server:
|
success-check-server:
|
||||||
name: Docker Build & Push Server Success
|
name: Docker Build & Push Server Success
|
||||||
|
Loading…
x
Reference in New Issue
Block a user