Files
immich-sync/.gitea/workflows/container.yml
T
feedc0de 49342eaef6
Publish container image / Build and push (push) Successful in 46s
Publish container image / Deploy to Kubernetes (push) Failing after 31s
bug fixes and depliyment
2026-08-04 20:59:49 +02:00

88 lines
2.7 KiB
YAML

name: Publish container image
on:
push:
env:
IMAGE: registry.brunner.ninja/feedc0de/immich-sync
jobs:
publish:
name: Build and push
runs-on: ubuntu-latest
steps:
- name: Check out source
uses: actions/checkout@v4
- name: Log in to Quay
uses: docker/login-action@v3
with:
registry: registry.brunner.ninja
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_TOKEN }}
- name: Build image
env:
COMMIT_SHA: ${{ gitea.sha }}
run: |
docker build \
--load \
--label "org.opencontainers.image.revision=${COMMIT_SHA}" \
--label "org.opencontainers.image.source=https://code.brunner.ninja/feedc0de/immich-sync" \
--tag "${IMAGE}:${COMMIT_SHA}" \
.
- name: Push commit tag
env:
COMMIT_SHA: ${{ gitea.sha }}
run: docker push "${IMAGE}:${COMMIT_SHA}"
- name: Push latest tag
if: gitea.ref == 'refs/heads/main'
env:
COMMIT_SHA: ${{ gitea.sha }}
run: |
docker tag "${IMAGE}:${COMMIT_SHA}" "${IMAGE}:latest"
docker push "${IMAGE}:latest"
deploy:
name: Deploy to Kubernetes
if: gitea.ref == 'refs/heads/main'
needs: publish
runs-on: ubuntu-latest
steps:
- name: Install kubectl
env:
KUBECTL_VERSION: v1.36.2
run: |
curl --fail --silent --show-error --location \
--output "${RUNNER_TEMP}/kubectl" \
"https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl"
curl --fail --silent --show-error --location \
--output "${RUNNER_TEMP}/kubectl.sha256" \
"https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl.sha256"
printf '%s %s\n' "$(cat "${RUNNER_TEMP}/kubectl.sha256")" "${RUNNER_TEMP}/kubectl" | sha256sum --check
chmod 0700 "${RUNNER_TEMP}/kubectl"
- name: Configure Kubernetes access
env:
KUBE_CONFIG_BASE64: ${{ secrets.KUBE_CONFIG_BASE64 }}
run: |
test -n "${KUBE_CONFIG_BASE64}"
printf '%s' "${KUBE_CONFIG_BASE64}" | base64 --decode > "${RUNNER_TEMP}/kubeconfig"
chmod 0600 "${RUNNER_TEMP}/kubeconfig"
- name: Deploy commit image
env:
COMMIT_SHA: ${{ gitea.sha }}
run: |
export KUBECONFIG="${RUNNER_TEMP}/kubeconfig"
"${RUNNER_TEMP}/kubectl" --namespace default set image \
deployment/immich-sync \
"immich-sync=${IMAGE}:${COMMIT_SHA}"
"${RUNNER_TEMP}/kubectl" --namespace default rollout status \
deployment/immich-sync \
--timeout=5m