mirror of
https://codeberg.org/icewind/haze.git
synced 2026-10-01 08:44:09 +02:00
book ci
This commit is contained in:
parent
d615322449
commit
070972a316
5 changed files with 109 additions and 0 deletions
58
.forgejo/workflows/book-pr.yaml
Normal file
58
.forgejo/workflows/book-pr.yaml
Normal 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 -->
|
||||
29
.forgejo/workflows/book.yaml
Normal file
29
.forgejo/workflows/book.yaml
Normal 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/
|
||||
|
|
@ -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
20
nix/book.nix
Normal 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/
|
||||
'';
|
||||
}
|
||||
|
|
@ -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 {};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue