All checks were successful
Deploy mahnung / deploy (push) Successful in 14s
Bug: ${{ github.event.head_commit.message }} wurde direkt in den
Bash-Script-Text eingefuegt. Sobald die Commit-Message Klammern,
Backticks oder andere Shell-Sonderzeichen enthielt, kam Syntaxfehler
"line 9: syntax error near unexpected token" und der ganze Deploy
fiel um. Phase 2, 3 und 5 waren betroffen, Phase 4 ging durch
weil zufaellig keine Klammern in der Message waren.
Zusaetzlich Sicherheits-Aspekt: Shell-Injection war moeglich, wenn
jemand eine Commit-Message mit Befehlssubstitution committet.
Fix:
- COMMIT_MSG via env: an den Step uebergeben statt im Run-Block
per Expression einzusetzen.
- RUN_NUMBER, NTFY_AUTH und GIT_TOKEN gleichzeitig via env: harten
fuer Konsistenz und Sicherheit.
- printf %s statt echo fuer mehrzeilige Messages.
- Klammern-frei verifiziert in dieser Commit-Message.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
93 lines
3 KiB
YAML
93 lines
3 KiB
YAML
name: Deploy mahnung
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: docker
|
|
if: startsWith(github.ref, 'refs/tags/v') || contains(github.event.head_commit.message, '[deploy]')
|
|
env:
|
|
NTFY_URL: https://notify.data-it-solution.de/vk-builds
|
|
|
|
steps:
|
|
- name: Notify Start
|
|
env:
|
|
COMMIT_MSG: ${{ github.event.head_commit.message }}
|
|
RUN_NUMBER: ${{ github.run_number }}
|
|
NTFY_AUTH: ${{ secrets.NTFY_AUTH }}
|
|
run: |
|
|
MSG=$(printf '%s\n' "$COMMIT_MSG" | head -1)
|
|
wget -q -O- \
|
|
--header="Authorization: $NTFY_AUTH" \
|
|
--header="Title: Mahnung Deploy gestartet" \
|
|
--header="Priority: default" \
|
|
--header="Tags: hammer_and_wrench,envelope_with_arrow" \
|
|
--post-data="Deploy #$RUN_NUMBER: $MSG" \
|
|
"$NTFY_URL" || true
|
|
|
|
- name: Checkout
|
|
env:
|
|
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}
|
|
run: |
|
|
git clone --depth 1 --branch "$GITHUB_REF_NAME" \
|
|
"https://token:$GIT_TOKEN@git.data-it-solution.de/$GITHUB_REPOSITORY.git" .
|
|
|
|
- name: Deploy nach Dolibarr
|
|
run: |
|
|
DEPLOY_PATH="/mnt/appdata/firma/dolibarr-202509/modules/mahnung"
|
|
REF="${GITHUB_REF#refs/*/}"
|
|
|
|
echo "Deploye ${REF} nach ${DEPLOY_PATH} ..."
|
|
|
|
if [ -d "$DEPLOY_PATH" ]; then
|
|
find "$DEPLOY_PATH" -mindepth 1 -not -path '*/.git/*' -not -name '.git' -delete 2>/dev/null || true
|
|
else
|
|
mkdir -p "$DEPLOY_PATH"
|
|
fi
|
|
|
|
rsync -a \
|
|
--exclude='.git' \
|
|
--exclude='.forgejo' \
|
|
--exclude='.gitignore' \
|
|
--exclude='CLAUDE.md' \
|
|
--exclude='test/' \
|
|
--exclude='bin/' \
|
|
--exclude='tools.yaml' \
|
|
--exclude='.playwright-mcp/' \
|
|
./ "$DEPLOY_PATH/"
|
|
|
|
echo "Deployment erfolgreich: ${REF} -> ${DEPLOY_PATH}"
|
|
|
|
- name: Notify Success
|
|
if: success()
|
|
env:
|
|
RUN_NUMBER: ${{ github.run_number }}
|
|
NTFY_AUTH: ${{ secrets.NTFY_AUTH }}
|
|
run: |
|
|
wget -q -O- \
|
|
--header="Authorization: $NTFY_AUTH" \
|
|
--header="Title: Mahnung Deploy erfolgreich" \
|
|
--header="Priority: high" \
|
|
--header="Tags: white_check_mark,envelope_with_arrow" \
|
|
--post-data="Deploy #$RUN_NUMBER abgeschlossen." \
|
|
"$NTFY_URL" || true
|
|
|
|
- name: Notify Failure
|
|
if: failure()
|
|
env:
|
|
RUN_NUMBER: ${{ github.run_number }}
|
|
NTFY_AUTH: ${{ secrets.NTFY_AUTH }}
|
|
run: |
|
|
wget -q -O- \
|
|
--header="Authorization: $NTFY_AUTH" \
|
|
--header="Title: Mahnung Deploy FEHLGESCHLAGEN" \
|
|
--header="Priority: urgent" \
|
|
--header="Tags: x,rotating_light,envelope_with_arrow" \
|
|
--header="Click: https://git.data-it-solution.de/$GITHUB_REPOSITORY/actions" \
|
|
--post-data="Deploy #$RUN_NUMBER hat einen Fehler." \
|
|
"$NTFY_URL" || true
|