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 run: | MSG=$(echo "${{ github.event.head_commit.message }}" | head -1) wget -q -O- \ --header="Authorization: ${{ secrets.NTFY_AUTH }}" \ --header="Title: Mahnung Deploy gestartet" \ --header="Priority: default" \ --header="Tags: hammer_and_wrench,envelope_with_arrow" \ --post-data="Deploy #${{ github.run_number }}: ${MSG}" \ "$NTFY_URL" || true - name: Checkout run: | git clone --depth 1 --branch "${GITHUB_REF_NAME}" \ "https://token:${{ secrets.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() run: | wget -q -O- \ --header="Authorization: ${{ secrets.NTFY_AUTH }}" \ --header="Title: Mahnung Deploy erfolgreich" \ --header="Priority: high" \ --header="Tags: white_check_mark,envelope_with_arrow" \ --post-data="Deploy #${{ github.run_number }} abgeschlossen." \ "$NTFY_URL" || true - name: Notify Failure if: failure() run: | wget -q -O- \ --header="Authorization: ${{ secrets.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 #${{ github.run_number }} hat einen Fehler." \ "$NTFY_URL" || true