diff --git a/.forgejo/workflows/deploy.yml b/.forgejo/workflows/deploy.yml index 04fbec7..9a51cd1 100644 --- a/.forgejo/workflows/deploy.yml +++ b/.forgejo/workflows/deploy.yml @@ -12,48 +12,52 @@ jobs: runs-on: docker if: startsWith(github.ref, 'refs/tags/v') || contains(github.event.head_commit.message, '[deploy]') steps: - - name: Notify Start - uses: data/ntfy-action@main - with: - url: https://notify.data-it-solution.de - topic: vk-builds - auth: ${{ secrets.NTFY_AUTH }} - project: Eplan - status: start - - 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 Prod + - name: Deploy nach Dolibarr run: | - ZIEL="/mnt/appdata/firma/dolibarr-202509/modules/eplan" - mkdir -p "$ZIEL"/{core/modules,admin,langs/de_DE,langs/en_US,lib} - cp core/modules/modEplan.class.php "$ZIEL/core/modules/" - cp admin/setup.php "$ZIEL/admin/" - cp lib/eplan.lib.php "$ZIEL/lib/" - cp langs/de_DE/eplan.lang "$ZIEL/langs/de_DE/" - cp langs/en_US/eplan.lang "$ZIEL/langs/en_US/" - echo "Deployt nach $ZIEL" - ls -la "$ZIEL/core/modules/" + DEPLOY_PATH="/mnt/appdata/firma/dolibarr-202509/modules/eplan" + 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' \ + ./ "$DEPLOY_PATH/" + + echo "Deployment erfolgreich: ${REF} -> ${DEPLOY_PATH}" + ls -la "$DEPLOY_PATH/core/modules/" - name: Notify Success if: success() - uses: data/ntfy-action@main - with: - url: https://notify.data-it-solution.de - topic: vk-builds - auth: ${{ secrets.NTFY_AUTH }} - project: Eplan - status: success + run: | + wget -q -O- \ + --header="Authorization: ${{ secrets.NTFY_AUTH }}" \ + --header="Title: Eplan deployt" \ + --header="Priority: high" \ + --header="Tags: white_check_mark" \ + --post-data="Eplan ${GITHUB_REF#refs/*/} auf Prod deployt" \ + https://notify.data-it-solution.de/vk-builds || true - name: Notify Failure if: failure() - uses: data/ntfy-action@main - with: - url: https://notify.data-it-solution.de - topic: vk-builds - auth: ${{ secrets.NTFY_AUTH }} - project: Eplan - status: failure + run: | + wget -q -O- \ + --header="Authorization: ${{ secrets.NTFY_AUTH }}" \ + --header="Title: Eplan Deploy fehlgeschlagen" \ + --header="Priority: urgent" \ + --header="Tags: rotating_light" \ + --post-data="Deploy fehlgeschlagen — ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_number }}" \ + https://notify.data-it-solution.de/vk-builds || true