Fix CI registry isolation and deployment prerequisites
This commit is contained in:
@@ -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
@@ -1,4 +1,4 @@
|
||||
FROM node:24-alpine
|
||||
FROM docker.io/library/node:24-alpine
|
||||
|
||||
ENV NODE_ENV=production \
|
||||
PORT=3000 \
|
||||
|
||||
Reference in New Issue
Block a user