ci: add deploy related config
All checks were successful
Preview Deploy / preview (push) Successful in 9s

This commit is contained in:
Flo 2026-11-01 12:33:23 +01:00
parent ec3cc6f0eb
commit d3f0b5c568
8 changed files with 195 additions and 608 deletions

View File

@ -0,0 +1,83 @@
name: Preview Deploy
on:
push:
branches:
- '*' # alle Branches
jobs:
preview:
runs-on: [ ubuntu-22.04 ]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create Preview Env
run: |
set -e
BRANCH="${{ github.ref_name }}"
REPO_FULL="${{ github.repository }}"
REPO="${REPO_FULL##*/}"
slug() {
printf '%s' "$1" \
| tr '[:upper:]' '[:lower:]' \
| sed -E 's#[^a-z0-9]+#-#g; s#^-+|-+$##g'
}
BRANCH_SLUG="$(slug "$BRANCH")"
REPO_SLUG="$(slug "$REPO")"
# RFC-safe, aber optisch getrennt:
SLUG="${REPO_SLUG}--${BRANCH_SLUG}"
{
echo "APP_SUBDOMAIN=$SLUG"
echo "APP_COMMIT_SHA=${{ github.sha }}"
echo "CI_BRANCH=$BRANCH"
echo "CI_REPO=$REPO_FULL"
} > .env.preview
echo "Preview-Subdomain: $SLUG"
- name: Deploy Docker Compose Preview
run: |
docker compose \
--env-file .env.preview \
-f docker/compose.preview.yml \
up -d --build
- name: Set Preview Commit Status
env:
CI_GITEA_TOKEN: ${{ secrets.CI_GITEA_TOKEN }}
run: |
set -e
source .env.preview
REPO="${{ github.repository }}"
SHA="${{ github.sha }}"
URL="https://${APP_SUBDOMAIN}.apps.pixel.cooking"
echo "Setting commit status for ${REPO}@${SHA} → ${URL}"
{
echo '{'
echo ' "state": "success",'
echo ' "target_url": "'"$URL"'",'
echo ' "description": "Preview deployment:",'
echo ' "context": "preview/'"$APP_SUBDOMAIN"'"'
echo '}'
} > body.json
curl -sS -X POST \
-H "Content-Type: application/json" \
-H "Authorization: token ${CI_GITEA_TOKEN}" \
"https://gitea.pixel.cooking/api/v1/repos/${REPO}/statuses/${SHA}" \
-d @body.json
- name: Display Preview URL
run: |
source .env.preview
echo "Preview URL: https://${APP_SUBDOMAIN}.apps.pixel.cooking"

15
Dockerfile Normal file
View File

@ -0,0 +1,15 @@
# 1) Build-Stage: Angular app bauen
FROM node:26-bookworm-slim AS build
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build -- --configuration production
# 2) Runtime-Stage: statische Files mit nginx ausliefern
FROM nginx:alpine
# Hier dein tatsächlicher Output-Path aus dem Build:
COPY --from=build /app/dist/mv-ng-typeahead/browser /usr/share/nginx/html

View File

@ -0,0 +1,24 @@
services:
web:
# Beispiel: Angular-App – passe Build-Kontext/Dockerfile an
build:
context: ..
dockerfile: Dockerfile
args:
COMMIT_SHA: ${APP_COMMIT_SHA}
ENV: preview
image: preview-${APP_SUBDOMAIN}:${APP_COMMIT_SHA}
# Falls dein Container nicht auf 80 lauscht, Port hier anpassen
labels:
- traefik.enable=true
- traefik.http.routers.${APP_SUBDOMAIN}.rule=Host(`${APP_SUBDOMAIN}.apps.pixel.cooking`)
- traefik.http.routers.${APP_SUBDOMAIN}.entrypoints=websecure
- traefik.http.routers.${APP_SUBDOMAIN}.tls.certresolver=le
- traefik.http.services.${APP_SUBDOMAIN}.loadbalancer.server.port=80
networks: [ proxy ]
networks:
proxy:
external: true

641
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -11,22 +11,24 @@
"private": true,
"packageManager": "npm@11.20.0",
"dependencies": {
"@angular/common": "^22.2.0",
"@angular/compiler": "^22.2.0",
"@angular/core": "^22.2.0",
"@angular/forms": "^22.2.0",
"@angular/platform-browser": "^22.2.0",
"@angular/router": "^22.2.0",
"rxjs": "~7.8.0",
"@angular/common": "^22.2.4",
"@angular/compiler": "^22.2.4",
"@angular/core": "^22.2.4",
"@angular/forms": "^22.2.4",
"@angular/platform-browser": "^22.2.4",
"@angular/router": "^22.2.4",
"rxjs": "~7.8.2",
"tslib": "^2.3.0"
},
"devDependencies": {
"@angular/build": "^22.2.5",
"@angular/cli": "^22.2.5",
"@angular/compiler-cli": "^22.2.0",
"@angular/compiler-cli": "^22.2.4",
"@emnapi/core": "1.11.3",
"@emnapi/runtime": "1.11.3",
"jsdom": "^30.0.0",
"prettier": "^3.8.1",
"typescript": "~6.0.2",
"vitest": "^5.0.0"
"typescript": "~6.0.3",
"vitest": "^5.0.5"
}
}
}

View File

@ -17,11 +17,6 @@ import { DiseaseTypeaheadComponent } from './disease-typeahead';
</p>
`,
styles: `
::highlight(search-match) {
background: #ffc600;
color: black;
}
.info {
text-align: center;
line-height: 2;

View File

@ -55,7 +55,11 @@ export class HighlightDirective {
write: (ranges) => {
if (!('highlights' in CSS)) return;
CSS.highlights.set('search-match', new Highlight(...ranges()));
CSS.highlights.delete('search-match');
if (ranges().length > 0) {
CSS.highlights.set('search-match', new Highlight(...ranges()));
}
},
});

View File

@ -15,3 +15,8 @@ body {
*:after {
box-sizing: inherit;
}
::highlight(search-match) {
background-color: #ffc600;
color: black;
}