Skip to content

Commit 361556d

Browse files
committed
docs: add cli rsync preview integration example
1 parent db7ccd3 commit 361556d

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

index.html

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,47 @@ <h3>Feed the preview URL into e2e</h3>
734734
run: yarn playwright test</code></pre>
735735
</div>
736736
</details>
737+
738+
<article class="timeline-step">
739+
<div class="timeline-index">4</div>
740+
<div>
741+
<h3>Use plain CLI + rsync instead of actions</h3>
742+
<p>
743+
If you do not want to depend on the public GitHub actions, you can upload
744+
preview builds from any CI runner with a plain shell step. The only requirement
745+
is to sync the built files into <code>/var/www/&lt;site&gt;/&lt;deploy&gt;</code>
746+
on the Selflify server.
747+
</p>
748+
</div>
749+
</article>
750+
751+
<details class="code-example">
752+
<summary class="code-example-summary">
753+
<span class="code-example-label">Shell snippet</span>
754+
<code>rsync preview upload</code>
755+
<span class="code-example-hint">Click to expand</span>
756+
</summary>
757+
<div class="code-block">
758+
<button class="copy-button" type="button" data-copy-target="github-preview-rsync">
759+
Copy
760+
</button>
761+
<pre><code id="github-preview-rsync">SITE=marketing
762+
DEPLOY_NAME="pr-${PR_NUMBER}"
763+
OUTPUT_DIR="dist"
764+
TARGET_DIR="/var/www/${SITE}/${DEPLOY_NAME}"
765+
766+
mkdir -p ~/.ssh
767+
printf '%s\n' "$PREVIEW_SSH_PRIVATE_KEY" > ~/.ssh/selflify-preview
768+
chmod 600 ~/.ssh/selflify-preview
769+
770+
rsync -az --delete \
771+
-e "ssh -i ~/.ssh/selflify-preview -o StrictHostKeyChecking=no" \
772+
"${OUTPUT_DIR}/" \
773+
"${PREVIEW_SSH_USER}@${PREVIEW_SERVER_HOST}:${TARGET_DIR}/"
774+
775+
echo "Preview URL: https://${DEPLOY_NAME}.${SITE}.${PREVIEW_BASE_DOMAIN}"</code></pre>
776+
</div>
777+
</details>
737778
</div>
738779
</section>
739780
</main>

0 commit comments

Comments
 (0)