Compare commits

...

4 Commits

Author SHA1 Message Date
Sven Vogel 1f031c050f ci: update prepare workflow to bake assets on Generate-Assets
Build'n check / run-ci-linux (push) Has been skipped Details
2024-11-30 18:16:57 +01:00
Sven Vogel 4513d993b4 feat: add page preview baker 2024-11-30 18:15:30 +01:00
Sven Vogel 86e5944390 fix: make page background white 2024-11-30 18:15:06 +01:00
Sven Vogel 5d770f04b4 fix: increase ppi of banner 2024-11-30 13:33:11 +01:00
5 changed files with 70 additions and 12 deletions

View File

@ -12,27 +12,44 @@ jobs:
env:
USERNAME: servostar
EMAIL: sven.vogel123@web.de
GIT_AUTH_TOKEN: ${{ secrets.RELEASE_TOKEN }}
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
steps:
- name: Check out repository code
uses: actions/checkout@v3
with:
ref: 'main'
token: ${{ secrets.RELEASE_TOKEN }}
- name: Tag Release Commit
env:
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
GIT_AUTH_TOKEN: ${{ secrets.RELEASE_TOKEN }}
- name: Install dependencies for Nix setup action
run: |
apt update -y
apt install sudo -y
- name: Setup Nix
uses: cachix/install-nix-action@v27
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Setup Git
run: |
export VERSION=$(echo "${COMMIT_MESSAGE}" | grep -Po '(?<=Release-As: )v\d+\.\d+\.\d+')
git config --global user.name "${USERNAME}"
git config --global user.email "${EMAIL}"
echo "==> Update typst.toml version"
- name: Update Typst.toml
run: |
export VERSION=$(echo "${COMMIT_MESSAGE}" | grep -Po '(?<=Release-As: )v\d+\.\d+\.\d+')
sed -i "/version/c\version = \"${VERSION#v}\"" typst.toml
git add typst.toml
git commit -m "chore: bump release version to $VERSION" -m "Generated-By: ${{ gitea.actor }}"
- name: Generate Example Document
run: nix-shell --run ./run-ci.sh
- name: Generate Assets
if: contains(github.event.head_commit.message, 'Generate-Assets')
run: |
./run-bake-assets.sh
git add assets/banner.png
git add assets/page-preview.png
git commit -m "chore: update assets" -m "Generated-By: ${{ gitea.actor }}"
- name: Tag and Push Changes
run: |
git push origin main
echo "::endgroup::"
echo "::group::{Tag commit}"
export VERSION=$(echo "${COMMIT_MESSAGE}" | grep -Po '(?<=Release-As: )v\d+\.\d+\.\d+')
git tag -m "Release" "${VERSION}"
git push origin "${VERSION}"
echo "::endgroup::"

34
baker/preview.typ Normal file
View File

@ -0,0 +1,34 @@
#let gap = 0.5cm
#set page(margin: 0pt, width: 210mm * 3 + 2 * gap, height: 297mm * 2 + gap, fill: rgb(0, 0, 0, 0))
#place(
dx: 0mm,
dy: 0mm,
image("./images/11.svg", height: 297mm))
#place(
dx: 210mm + gap,
dy: 0mm,
image("./images/21.svg", height: 297mm))
#place(
dx: (210mm + gap) * 2,
dy: 0mm,
image("./images/31.svg", height: 297mm))
#place(
dx: 210mm * 0,
dy: 297mm + gap,
image("./images/71.svg", height: 297mm))
#place(
dx: (210mm + gap) * 1,
dy: 297mm + gap,
image("./images/41.svg", height: 297mm))
#place(
dx: (210mm + gap) * 2,
dy: 297mm + gap,
image("./images/51.svg", height: 297mm))

View File

@ -1,12 +1,18 @@
#!/bin/bash
mkdir images
echo "==> generate images"
mkdir images || true
# extract images from document created by action
mutool convert -o images/1.svg "$1" 1
mutool convert -o images/2.svg "$1" 2
mutool convert -o images/2.svg "$1" 2
mutool convert -o images/3.svg "$1" 5
mutool convert -o images/7.svg "$1" 7
mutool convert -o images/4.svg "$1" 15
mutool convert -o images/5.svg "$1" 16
typst compile banner.typ --ppi 220 ../assets/banner.png
echo "==> generate banner"
typst compile banner.typ --ppi 360 ../assets/banner.png
echo "==> generate preview"
typst compile preview.typ --ppi 360 ../assets/page-preview.png

View File

@ -2,5 +2,5 @@
cd baker
echo "==> generate banner image"
echo "==> generate assets"
nix-shell --run "./run-bake-banner.sh ../example.pdf"

View File

@ -241,6 +241,7 @@
set page(
paper: style.page.format,
foreground: watermark(config),
background: [#rect(width: 100%, height: 100%, fill: white)],
header-ascent: style.header.content-padding,
footer-descent: style.header.content-padding,
margin: (