1
0
Fork 0
mirror of https://codeberg.org/icewind/haze.git synced 2026-10-01 08:44:09 +02:00
This commit is contained in:
Robin Appelman 2026-09-20 18:28:33 +02:00
commit 070972a316
5 changed files with 109 additions and 0 deletions

View file

@ -0,0 +1,58 @@
name: "Book - PR"
on:
pull_request:
types:
- opened
- reopened
- synchronize
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 -->

View file

@ -0,0 +1,29 @@
name: "Book"
on:
push:
branches:
- main
jobs:
preview:
runs-on: nix
env:
SITE_ORIGIN: "${{forge.event.repository.owner.username}}.codeberg.page"
SITE_BASEPATH: "/${{forge.event.repository.name}}/"
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
- uses: https://codeberg.org/git-pages/action@v2
with:
site: https://${{ env.SITE_ORIGIN }}${{ env.SITE_BASEPATH }}
token: ${{ forge.token }}
source: dist/

View file

@ -55,6 +55,7 @@
"haze-image-php-8.2" = pkgs: pkgs.haze-image-php-82;
"haze-image-php-8.1" = pkgs: pkgs.haze-image-php-81;
"haze-image-php-8.0" = pkgs: pkgs.haze-image-php-80;
haze-book = pkgs: pkgs.haze-book;
};
tools = pkgs:

20
nix/book.nix Normal file
View file

@ -0,0 +1,20 @@
{
mdbook,
stdenv,
...
}:
stdenv.mkDerivation {
name = "haze-book";
src = ../book;
nativeBuildInputs = [mdbook];
buildPhase = ''
mdbook build
'';
installPhase = ''
mkdir -p $out
cp -r book/* $out/
'';
}

View file

@ -6,4 +6,5 @@ final: prev: {
haze-image-php-82 = final.callPackage ./image/haze.nix {php = final.php82;};
haze-image-php-81 = final.callPackage ./image/haze.nix {php = final.php81;};
haze-image-php-80 = final.callPackage ./image/haze.nix {php = final.php80;};
haze-book = final.callPackage ./book.nix {};
}