Compare commits

..

2 commits

Author SHA1 Message Date
raf
edda78d91e
Merge 7324474ef8 into 73660af2e3 2024-12-11 02:40:04 +03:00
7324474ef8
ci: build previws for the website on doc changes 2024-12-11 02:39:59 +03:00

View file

@ -68,41 +68,59 @@ jobs:
needs: build-preview
runs-on: ubuntu-latest
steps:
- name: Set preview URL
id: set-url
- name: Prepare Environment
id: prelude
run: |
PR_NUMBER=${{ github.event.pull_request.number }}
URL="https://${{ github.repository_owner }}.github.io/nvf/docs-preview-${PR_NUMBER}/"
echo "Live Preview URL: $URL"
# Propagate non-interpolatable environment vars
echo "URL=$URL" >> "$GITHUB_OUTPUT"
echo "REV=$GITHUB_SHA" >> "$GITHUB_OUTPUT"
echo "ACTOR=$GITHUB_ACTOR" >> "$GITHUB_OUTPUT"
echo "REF=$GITHUB_HEAD_REF" >> "$GITHUB_OUTPUT"
echo "RUNS=$GITHUB_RUN_NUMBER" >> "$GITHUB_OUTPUT"
echo "Live Preview URL: $URL"
echo "Rev: $GITHUB_SHA"
echo "Actor: $GITHUB_ACTOR"
echo "Ref: "$GITHUB_HEAD_REF"
echo "Reruns: "$GITHUB_RUN_NUMBER"
echo "### :rocket: Live Preview Deployed " >> "$GITHUB_STEP_SUMMARY"
echo "Preview can be found at ${URL}" >> "$GITHUB_STEP_SUMMARY""
echo "Preview can be found at ${URL}" >> "$GITHUB_STEP_SUMMARY"
- name: Find Comment
uses: peter-evans/find-comment@v3
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: "github-actions[bot]"
body-includes: "Live preview is ready"
issue-number: ${{ github.event.pull_request.number }}
body-includes: "Live preview deployed"
- name: Post live preview comment
uses: peter-evans/create-or-update-comment@v4
env:
COMMENT_ID: ${{ steps.fc.outputs.comment-id }}
URL: ${{ steps.prelude.outputs.URL }}
GITHUB_SHA: ${{ steps.prelude.outputs.REV }}
ACTOR: ${{ steps.prelude.outputs.ACTOR }}
REF: ${{ steps.prelude.outputs.REF }}
RUNS: ${{ steps.prelude.outputs.RUNS }}
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
comment-id: ${{ env.COMMENT_ID }}
issue-number: ${{ github.event.pull_request.number }} # issue number also applies to pull requests
edit-mode: replace # replace previous body
body: |
### 🚀 **Live preview deployed from ${GITHUB_SHA}**
View it here: ${{ steps.set-url.outputs.URL }}
### :rocket: Live preview deployed from ${{ env.GITHUB_SHA }}
View it [here](${{ env.URL }}):
<details>
<summary>Debug Information</summary>
<p>Triggered by: ${GITHUB_ACTOR}</p>
<p>HEAD at: ${GITHUB_HEAD_REF}</p>
<p>Reruns: ${GITHUB_RUN_NUMBER}</p>
<summary><strong>Debug Information</strong></summary>
<p>Triggered by: ${{ env.ACTOR }}</p>
<p><code>HEAD</code> at: ${{ env.REF }}</p>
<p>Reruns: ${{ env.RUNS }}</p>
</details>
cleanup: