Fix CI registry isolation and deployment prerequisites
Publish and deploy birthday invitation / Check JavaScript (push) Successful in 7s
Publish and deploy birthday invitation / Build and push (push) Successful in 15s
Publish and deploy birthday invitation / Deploy to Kubernetes (push) Successful in 2m59s

This commit is contained in:
2026-10-14 20:57:49 +02:00
parent f18630260a
commit d11e02bc5c
2 changed files with 32 additions and 18 deletions
+31 -17
View File
@@ -11,38 +11,48 @@ env:
jobs:
test:
name: Check JavaScript
runs-on: ubuntu-latest
runs-on: linux_amd64
steps:
- name: Check out source
uses: actions/checkout@v4
- name: Check server and browser scripts
run: |
docker run --rm --interactive node:24-alpine node --check - < server.js
docker run --rm --interactive node:24-alpine node --check - < database.js
docker run --rm --interactive node:24-alpine node --check - < public/app.js
docker run --rm --interactive node:24-alpine node --check - < public/admin.js
authfile=$(mktemp)
trap 'rm -f "$authfile"' EXIT
printf '{"auths":{}}' > "$authfile"
export REGISTRY_AUTH_FILE="$authfile"
podman run --rm --interactive docker.io/library/node:24-alpine node --check - < server.js
podman run --rm --interactive docker.io/library/node:24-alpine node --check - < database.js
podman run --rm --interactive docker.io/library/node:24-alpine node --check - < public/app.js
podman run --rm --interactive docker.io/library/node:24-alpine node --check - < public/admin.js
publish:
name: Build and push
if: gitea.ref == 'refs/heads/main'
needs: test
runs-on: ubuntu-latest
runs-on: linux_amd64
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: Configure isolated registry access
env:
QUAY_USERNAME: ${{ secrets.QUAY_USERNAME }}
QUAY_TOKEN: ${{ secrets.QUAY_TOKEN }}
run: |
set -euo pipefail
authfile="${RUNNER_TEMP}/quay-auth.json"
printf '{"auths":{}}' > "$authfile"
chmod 0600 "$authfile"
printf '%s' "$QUAY_TOKEN" | podman login registry.brunner.ninja \
--authfile "$authfile" --username "$QUAY_USERNAME" --password-stdin
echo "REGISTRY_AUTH_FILE=$authfile" >> "$GITHUB_ENV"
- name: Build image
env:
COMMIT_SHA: ${{ gitea.sha }}
run: |
docker build \
--load \
podman build \
--label "org.opencontainers.image.revision=${COMMIT_SHA}" \
--label "org.opencontainers.image.source=https://code.brunner.ninja/feedc0de/30-birthday" \
--tag "${IMAGE}:${COMMIT_SHA}" \
@@ -51,15 +61,19 @@ jobs:
- name: Push commit tag
env:
COMMIT_SHA: ${{ gitea.sha }}
run: docker push "${IMAGE}:${COMMIT_SHA}"
run: podman 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"
podman tag "${IMAGE}:${COMMIT_SHA}" "${IMAGE}:latest"
podman push "${IMAGE}:latest"
- name: Remove registry credentials
if: always()
run: rm -f "${RUNNER_TEMP}/quay-auth.json"
deploy:
name: Deploy to Kubernetes
+1 -1
View File
@@ -1,4 +1,4 @@
FROM node:24-alpine
FROM docker.io/library/node:24-alpine
ENV NODE_ENV=production \
PORT=3000 \