Initial scaffold: React/Vite/TS PWA + Express/Prisma/Postgres backend
Materialschein & Kabelrechner für BergVOLT Elektrotechnik, portiert von der vorherigen Single-File-HTML-Version. Microsoft-Entra-ID-Login (MSAL), Projekt- Dashboard statt einer Datei pro Kunde, Retour-Buchen-Zusammenführung, 111 Kabeltypen aus den offiziellen Meinhart-Datenblättern. gitops/ nach PROX/deploy-standard: git-backed Portainer-Stack, versionierte Docker-Images, CI-Commit-back auf gitops/stack.yml. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
name: Build and Deploy
|
||||
|
||||
# Standard-Workflow git.prox.ws → Portainer (siehe deploy-standard-Repo README).
|
||||
# owner = bergvolt (Package-Namespace == Repo-Owner, lowercase für OCI), name = materialschein.
|
||||
#
|
||||
# Versionierung: VERSION = <gitops/version : major.minor>.<git rev-list --count HEAD>.
|
||||
# Ein version-Job berechnet sie, build + deploy konsumieren sie über
|
||||
# needs.version.outputs.version. Der deploy-Job pinnt gitops/stack.yml per
|
||||
# Commit-back auf :<VERSION> — nie floating :latest.
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
version:
|
||||
runs-on: linux
|
||||
outputs:
|
||||
version: ${{ steps.v.outputs.VERSION }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- id: v
|
||||
run: |
|
||||
BASE=$(cat gitops/version | tr -d '[:space:]')
|
||||
PATCH=$(git rev-list --count HEAD)
|
||||
echo "VERSION=${BASE}.${PATCH}" >> "$GITHUB_OUTPUT"
|
||||
echo "version ${BASE}.${PATCH}"
|
||||
|
||||
build:
|
||||
runs-on: linux
|
||||
needs: version
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Login to Gitea Registry
|
||||
run: |
|
||||
echo "${{ secrets.GITEAPASSWORD }}" | docker login -u ${{ secrets.GITEAUSER }} --password-stdin https://git.prox.ws
|
||||
|
||||
- name: Build and Push
|
||||
run: |
|
||||
V=${{ needs.version.outputs.version }}
|
||||
docker build \
|
||||
-t git.prox.ws/bergvolt/materialschein:$V \
|
||||
-t git.prox.ws/bergvolt/materialschein:latest \
|
||||
.
|
||||
docker push git.prox.ws/bergvolt/materialschein:$V
|
||||
docker push git.prox.ws/bergvolt/materialschein:latest
|
||||
|
||||
deploy:
|
||||
runs-on: linux
|
||||
needs: [version, build]
|
||||
steps:
|
||||
- name: Checkout main (mit Push-Recht)
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref_name }}
|
||||
token: ${{ secrets.GITEA_TOKEN }}
|
||||
|
||||
- name: Pin stack to version + commit-back
|
||||
run: |
|
||||
V=${{ needs.version.outputs.version }}
|
||||
sed -i -E "s#(image: git\.prox\.ws/[^:[:space:]]+):[^[:space:]]+#\1:$V#" gitops/stack.yml
|
||||
if git diff --quiet gitops/stack.yml; then
|
||||
echo "stack.yml schon auf $V, kein Commit-back"
|
||||
else
|
||||
git config user.name "gitea-actions"
|
||||
git config user.email "actions@git.prox.ws"
|
||||
git commit -am "deploy: v$V [skip ci]"
|
||||
git push
|
||||
fi
|
||||
|
||||
- name: Trigger Portainer Stack Redeploy
|
||||
run: |
|
||||
test -n "${{ secrets.PORTAINER_WEBHOOK_URL }}" || { echo "secret PORTAINER_WEBHOOK_URL is not set"; exit 1; }
|
||||
curl -fsSk --retry 3 --retry-delay 5 -X POST "${{ secrets.PORTAINER_WEBHOOK_URL }}"
|
||||
Reference in New Issue
Block a user