mirror of
https://codeberg.org/icewind/haze.git
synced 2026-10-01 08:44:09 +02:00
61 lines
1.9 KiB
YAML
61 lines
1.9 KiB
YAML
name: "Book - PR"
|
|
|
|
on:
|
|
pull_request:
|
|
types:
|
|
- opened
|
|
- reopened
|
|
- synchronize
|
|
paths:
|
|
- ".forgejo/workflows/book-pr.yaml"
|
|
- "book/**"
|
|
|
|
concurrency:
|
|
group: page-preview
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
createPreview:
|
|
runs-on: nix
|
|
env:
|
|
SITE_ORIGIN:
|
|
"https://${{ forge.event.repository.owner.username
|
|
}}.preview.codeberg.page"
|
|
SITE_BASEPATH:
|
|
"/${{ forge.event.repository.name }}@${{ forge.event.number }}/"
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: https://codeberg.org/icewind/attic-action@v1
|
|
with:
|
|
name: link
|
|
instance: https://cache.icewind.link
|
|
authToken: "${{ secrets.ATTIC_TOKEN }}"
|
|
- name: Build
|
|
run: |
|
|
# git-pages/action doesn't like symlinks
|
|
cp -r $(nix build .#haze-book --print-out-paths --no-link) dist
|
|
- name: "Deploy Site"
|
|
uses: https://code.forgejo.org/actions/git-pages@v2
|
|
with:
|
|
site: "${{ env.SITE_ORIGIN }}${{ env.SITE_BASEPATH }}" #
|
|
token: "${{ forge.token }}" #
|
|
source: "dist/" #
|
|
- name: "Find comment"
|
|
uses: "https://github.com/peter-evans/find-comment@v4" #
|
|
id: comment
|
|
with:
|
|
issue-number: ${{ forge.event.number }} #
|
|
body-includes: "<!-- preview-comment -->" #
|
|
- name: "Create or update comment"
|
|
uses: "https://github.com/peter-evans/create-or-update-comment@v5" #
|
|
with:
|
|
issue-number: ${{ forge.event.number }} #
|
|
comment-id: "${{ steps.comment.outputs.comment-id }}" #
|
|
edit-mode: "replace"
|
|
body: |-
|
|
# Pull request preview ready!
|
|
|
|
The Preview of commit ${{ forge.event.pull_request.head.sha }} has been created.
|
|
You can find it here: ${{ env.SITE_ORIGIN }}${{ env.SITE_BASEPATH }}
|
|
|
|
<!-- preview-comment -->
|