fix(search): swap to CSP-safe offline search + audit fixes #76
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy MSK Scripts Docs | |
| on: | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: read | |
| # Needed to post a legacy commit status under context "CI" so that | |
| # PR-management UIs that only read the older Statuses API (rather | |
| # than the newer Check-Runs API) show the merge commits as green | |
| # instead of stuck-on-pending. | |
| statuses: write | |
| jobs: | |
| build-and-deploy: | |
| name: Build & Deploy | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: ⬇️ Checkout Repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: 🟢 Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 22 | |
| cache: yarn | |
| - name: 📦 Install Dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: 🏗️ Build Project | |
| run: yarn build | |
| - name: 🚀 Deploy to Server via SFTP | |
| uses: appleboy/scp-action@master | |
| with: | |
| host: ${{ secrets.FTP_SERVER }} | |
| username: ${{ secrets.FTP_USERNAME }} | |
| key: ${{ secrets.SSH_PRIVATE_KEY }} | |
| port: ${{ secrets.FTP_PORT }} | |
| source: "build/*" | |
| target: "/var/www/html/docs_msk-scripts/" | |
| strip_components: 1 | |
| - name: 🛠️ Postdeploy — Ownership, CSP-Snippet, Apache-Reload | |
| uses: appleboy/ssh-action@master | |
| with: | |
| host: ${{ secrets.FTP_SERVER }} | |
| username: ${{ secrets.FTP_USERNAME }} | |
| key: ${{ secrets.SSH_PRIVATE_KEY }} | |
| port: ${{ secrets.FTP_PORT }} | |
| script_stop: true | |
| script: | | |
| set -euo pipefail | |
| DOCROOT=/var/www/html/docs_msk-scripts | |
| SNIPPETS_DIR=/etc/apache2/snippets | |
| SNIPPET_DST="${SNIPPETS_DIR}/docu-csp-hashes.conf" | |
| SNIPPET_SRC="${DOCROOT}/csp-hashes.conf" | |
| echo "::group::Datei-Besitzer auf www-data setzen" | |
| chown -R www-data:www-data "${DOCROOT}" | |
| echo "::endgroup::" | |
| echo "::group::CSP-Snippet ablegen" | |
| if [ ! -f "${SNIPPET_SRC}" ]; then | |
| echo "❌ ${SNIPPET_SRC} fehlt — build erzeugt es normalerweise via scripts/generate-csp.mjs" | |
| exit 1 | |
| fi | |
| mkdir -p "${SNIPPETS_DIR}" | |
| install -o root -g root -m 0644 "${SNIPPET_SRC}" "${SNIPPET_DST}" | |
| # Snippet aus dem DocumentRoot wieder entfernen, damit es nicht | |
| # versehentlich öffentlich ausgeliefert wird (FilesMatch im vhost | |
| # schützt zusätzlich, aber doppelt hält besser). | |
| rm -f "${SNIPPET_SRC}" | |
| echo "✓ ${SNIPPET_DST} aktualisiert" | |
| echo "::endgroup::" | |
| echo "::group::Apache-Config testen" | |
| apachectl configtest | |
| echo "::endgroup::" | |
| echo "::group::Apache reloaden" | |
| systemctl reload apache2 | |
| systemctl is-active --quiet apache2 && echo "✓ apache2 läuft" | |
| echo "::endgroup::" | |
| - name: ✅ Post CI commit status (legacy API) | |
| if: always() | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const state = '${{ job.status }}' === 'success' ? 'success' : 'failure'; | |
| await github.rest.repos.createCommitStatus({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| sha: context.sha, | |
| state, | |
| context: 'CI', | |
| description: | |
| state === 'success' | |
| ? 'Build + deploy green' | |
| : 'Build or deploy failed — see workflow logs', | |
| target_url: `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`, | |
| }); |