Compare commits

..

No commits in common. "main" and "fix/centered-glossary" have entirely different histories.

6 changed files with 118 additions and 81 deletions

View File

@ -1,19 +1,10 @@
name: Build'n check
name: Gitea Action for checking typst compilation
run-name: Performing Typst compilation
on:
push:
pull_request:
branches:
- main
on: [push]
jobs:
run-ci-linux:
runs-on: ubuntu-latest
# run action mutally exclusive on PRs or
# push with commit containing "Run-Checks"
if: >
(contains(github.event.head_commit.message, 'Run-Checks') &&
github.event_name == 'push') ||
github.event_name == 'pull_request'
steps:
- name: Check out repository code
uses: actions/checkout@v3
@ -25,9 +16,5 @@ jobs:
uses: cachix/install-nix-action@v27
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Stylecheck
run: nix-shell --run "./run-fmt.sh --check src/lib.typ"
- id: build
name: Build
run: |
nix-shell --run ./run-ci.sh
- name: Run CI
run: nix-shell --run ./run-ci.sh

View File

@ -0,0 +1,34 @@
name: release
on:
push:
tags:
- 'v*.*.*'
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
- 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: Run CI
run: nix-shell --run ./run-ci.sh
- name: Setup go
uses: https://github.com/actions/setup-go@v4
with:
go-version: '>=1.20.1'
- name: Create release
id: create-release
uses: https://gitea.com/actions/release-action@main
with:
files: |-
example.pdf
api_key: '${{secrets.RELEASE_TOKEN}}'

16
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,16 @@
name: GitHub Action for checking typst compilation
run-name: Performing Typst compilation
on: [push]
jobs:
run-ci-linux:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Setup Nix
uses: cachix/install-nix-action@v27
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Run CI
run: nix-shell --run ./run-ci.sh

View File

@ -1,13 +1,12 @@
name: Build'n check
name: release
on:
push:
branches:
- main
tags:
- 'v*.*.*'
jobs:
build:
name: Check Template and Build example
release:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
@ -16,49 +15,16 @@ jobs:
uses: cachix/install-nix-action@v27
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Stylecheck
run: nix-shell --run "./run-fmt.sh --check src/lib.typ"
- id: build
name: Build
run: |
nix-shell --run ./run-ci.sh
- name: Upload artifact
id: artifact-upload
uses: actions/upload-artifact@v3
with:
name: example-document
path: ${{ github.workspace }}/example.pdf
if-no-files-found: error
retention-days: 1
- name: Output artifact ID
run: echo 'Artifact ID is ${{ steps.artifact-upload.outputs.artifact-id }}'
release:
runs-on: ubuntu-latest
needs: build
if: startsWith(github.ref, 'refs/tags/')
permissions:
contents: write
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Run CI
run: nix-shell --run ./run-ci.sh
- name: Setup go
uses: actions/setup-go@v4
uses: https://github.com/actions/setup-go@v4
with:
go-version: '>=1.20.1'
- name: Download Artifcat
id: download
uses: actions/download-artifact@v3
- name: Create release
id: create-release
uses: https://gitea.com/actions/release-action@main
with:
name: example-document
path: ${{ github.workspace }}/Example.pdf
- name: 'Artifact Download Path'
run: echo ${{ steps.download.outputs.download-path }}
- name: Prepare Release
run: echo ${{ github.sha }} > Release.txt
- name: Release
uses: softprops/action-gh-release@v2
with:
files: |
Example.pdf
Release.txt
LICENSE
files: |-
example.pdf
api_key: '${{secrets.RELEASE_TOKEN}}'

18
LICENSE
View File

@ -2,20 +2,8 @@ MIT License
Copyright (c) 2024 Sven Vogel
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -1,3 +1,49 @@
#!/bin/bash
typst compile template/main.typ --root . --font-path fonts example.pdf
function log() {
local timestamp=$(date +"%Y-%m-%d %H:%M:%S")
echo "$1 at $timestamp: $2"
}
function abort() {
log "ERROR" "test case $1 has failed"
exit 1
}
function print-box() {
printf "\\n"
echo ".----------------------------------------------------------------."
printf "| %-62s |\\n" "$1"
echo "'----------------------------------------------------------------'"
}
function enter-section() {
print-box "$1"
log "INFO" "running task in section $1: $2"
log "INFO" "section output following..."
printf "\\n"
eval "$2"
exit_status=$?
if [ "$3" == "should fail" ]; then
log "INFO" "expected to fail..."
if [ $exit_status -eq 0 ]; then
abort "command: $2 failed in section: $1 with: $exit_status"
fi
else
log "INFO" "expected to pass..."
if [ ! $exit_status -eq 0 ]; then
abort "command: $2 failed in section: $1 with: $exit_status"
fi
fi
printf "\\n"
log "INFO" "section $1 completed successfully"
}
enter-section "Typstyle checking" "./run-fmt.sh --check src/lib.typ" 0
enter-section "Compiling template..." "typst compile template/main.typ --root . --font-path fonts example.pdf"
log "INFO" "CI completed successfully"