From 4c55b9cc7fd667071a1453389cffc515798d6d82 Mon Sep 17 00:00:00 2001 From: servostar Date: Mon, 25 Nov 2024 09:10:49 +0100 Subject: [PATCH 01/10] ci: draft release pipeline --- .gitea/workflows/release.yml | 65 ++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 .gitea/workflows/release.yml diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml new file mode 100644 index 0000000..6142821 --- /dev/null +++ b/.gitea/workflows/release.yml @@ -0,0 +1,65 @@ +name: Build'n check +on: + push: + branches: + - main +jobs: + build: + name: Check Template and Build example + 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: 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 + steps: + - name: Check out repository code + uses: actions/checkout@v3 + - name: Setup go + uses: actions/setup-go@v4 + with: + go-version: '>=1.20.1' + - name: Download Artifcat + id: download + uses: actions/download-artifact@v3 + 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: Create release + id: create-release + uses: https://gitea.com/actions/release-action@main + with: + files: |- + Example.pdf + Release.txt + LICENSE + api_key: '${{secrets.RELEASE_TOKEN}}' -- 2.40.1 From 5dece112cb0fa3aec24f19a47bd4af20f3f1c213 Mon Sep 17 00:00:00 2001 From: servostar Date: Mon, 25 Nov 2024 09:11:08 +0100 Subject: [PATCH 02/10] ci: bump artifact actions to v4 --- .gitea/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 6142821..d5a5c8e 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -26,7 +26,7 @@ jobs: nix-shell --run ./run-ci.sh - name: Upload artifact id: artifact-upload - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: example-document path: ${{ github.workspace }}/example.pdf @@ -46,7 +46,7 @@ jobs: go-version: '>=1.20.1' - name: Download Artifcat id: download - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: example-document path: ${{ github.workspace }}/Example.pdf -- 2.40.1 From 1567c6212c761d0bb3d3b777f3fc790ba764fbab Mon Sep 17 00:00:00 2001 From: servostar Date: Mon, 25 Nov 2024 09:11:31 +0100 Subject: [PATCH 03/10] style: fix spelling mistake in CI --- .gitea/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index d5a5c8e..6ec519d 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -44,7 +44,7 @@ jobs: uses: actions/setup-go@v4 with: go-version: '>=1.20.1' - - name: Download Artifcat + - name: Download Artifact id: download uses: actions/download-artifact@v4 with: -- 2.40.1 From e77de7aec53d30e1397bafc71c23116a6e6ce565 Mon Sep 17 00:00:00 2001 From: servostar Date: Mon, 25 Nov 2024 10:10:33 +0100 Subject: [PATCH 04/10] ci: run release on PR --- .gitea/workflows/release.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 6ec519d..ed9d0a9 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -1,8 +1,10 @@ name: Build'n check on: - push: + pull_request: branches: - main + types: + - closed jobs: build: name: Check Template and Build example -- 2.40.1 From fe9fa2e614bb07ecefda10463c7ca250f018535d Mon Sep 17 00:00:00 2001 From: servostar Date: Mon, 25 Nov 2024 10:10:55 +0100 Subject: [PATCH 05/10] ci: run release job when release message is present --- .gitea/workflows/release.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index ed9d0a9..4e1410a 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -39,6 +39,9 @@ jobs: release: runs-on: ubuntu-latest needs: build + if: contains(github.event.head_commit.message, 'Release-As:') + env: + USERNAME: servostar steps: - name: Check out repository code uses: actions/checkout@v3 -- 2.40.1 From 6695c5e20448f7559a81eb6e3e79ec6c8ea973be Mon Sep 17 00:00:00 2001 From: servostar Date: Mon, 25 Nov 2024 10:11:11 +0100 Subject: [PATCH 06/10] ci: tag release commit --- .gitea/workflows/release.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 4e1410a..259d3b1 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -59,6 +59,14 @@ jobs: run: echo ${{ steps.download.outputs.download-path }} - name: Prepare Release run: echo ${{ github.sha }} > Release.txt + - name: Tag Release Commit + run: | + echo ${{github.event.head_commit.message}} | grep -Po '(?<=Release-As: )v\d+\.\d+\.\d+' > Version.txt + echo "==> Tagging for version: $(cat Version.txt)" + git config --global credential.helper store + echo "https://${USERNAME}:${{secrets.RELEASE_TOKEN}}}@${{github.repositoryUrl}}" > ~/.git-credentials + git tag -m "Release" $(cat Version.txt) + git push ${{github.repositoryUrl}} $(cat Version.txt) - name: Create release id: create-release uses: https://gitea.com/actions/release-action@main @@ -66,5 +74,6 @@ jobs: files: |- Example.pdf Release.txt + Version.txt LICENSE api_key: '${{secrets.RELEASE_TOKEN}}' -- 2.40.1 From c819704b49a96fc3db693fbb2d1688ec156702e8 Mon Sep 17 00:00:00 2001 From: servostar Date: Mon, 25 Nov 2024 10:27:46 +0100 Subject: [PATCH 07/10] ci: revert artifact up- and download action to v3 --- .gitea/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 259d3b1..18156b2 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -28,7 +28,7 @@ jobs: nix-shell --run ./run-ci.sh - name: Upload artifact id: artifact-upload - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v3 with: name: example-document path: ${{ github.workspace }}/example.pdf @@ -51,7 +51,7 @@ jobs: go-version: '>=1.20.1' - name: Download Artifact id: download - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v3 with: name: example-document path: ${{ github.workspace }}/Example.pdf -- 2.40.1 From c961dacf967a7831a8b44df1fe93b5b9bd7fa41e Mon Sep 17 00:00:00 2001 From: servostar Date: Mon, 25 Nov 2024 10:31:30 +0100 Subject: [PATCH 08/10] ci: add ripgrep to nix shell --- shell.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/shell.nix b/shell.nix index e3ea31b..12fabe3 100644 --- a/shell.nix +++ b/shell.nix @@ -9,5 +9,6 @@ pkgs.mkShellNoCC { python312Packages.pyyaml typst typstyle + ripgrep ]; } -- 2.40.1 From 84af717ce718506074b4668649025cfb973b8be7 Mon Sep 17 00:00:00 2001 From: servostar Date: Mon, 25 Nov 2024 10:31:47 +0100 Subject: [PATCH 09/10] style: run formatter --- src/glossarium.typ | 81 ++++++++++++++++++++++++---------------------- 1 file changed, 42 insertions(+), 39 deletions(-) diff --git a/src/glossarium.typ b/src/glossarium.typ index 2da8c9d..9db2172 100644 --- a/src/glossarium.typ +++ b/src/glossarium.typ @@ -200,46 +200,49 @@ SOFTWARE.*/ #block( below: 1.5em, width: 100%, - par(hanging-indent: 1em, align(left)[ - #text(weight: "bold", entry.short) - #if hasLong and hasDesc [ - (#text(entry.long)) - ] else if hasLong { - text(entry.long) - } - #if hasDesc [ #sym.dash.en ] - #if hasDesc [ #desc ] - #if disable-back-references != true { - term_references - .map(x => x.location()) - .sorted(key: x => x.page()) - .fold( - (values: (), pages: ()), - ((values, pages), x) => if pages.contains( - x.page(), - ) { - (values: values, pages: pages) - } else { - values.push(x) - pages.push(x.page()) - (values: values, pages: pages) - }, - ) - .values - .map(x => { - let page-numbering = x.page-numbering() - if page-numbering == none { - page-numbering = "1" + par( + hanging-indent: 1em, + align(left)[ + #text(weight: "bold", entry.short) + #if hasLong and hasDesc [ + (#text(entry.long)) + ] else if hasLong { + text(entry.long) + } + #if hasDesc [ #sym.dash.en ] + #if hasDesc [ #desc ] + #if disable-back-references != true { + term_references + .map(x => x.location()) + .sorted(key: x => x.page()) + .fold( + (values: (), pages: ()), + ((values, pages), x) => if pages.contains( + x.page(), + ) { + (values: values, pages: pages) + } else { + values.push(x) + pages.push(x.page()) + (values: values, pages: pages) + }, + ) + .values + .map(x => { + let page-numbering = x.page-numbering() + if page-numbering == none { + page-numbering = "1" + } + link(x)[#numbering( + page-numbering, + ..counter(page).at(x), + )] } - link(x)[#numbering( - page-numbering, - ..counter(page).at(x), - )] - } - ) - .join(", ") - } - ]), + ) + .join(", ") + } + ], + ), ) ] } -- 2.40.1 From cc4d2175473cdfde1653063f24f8f326597f12c8 Mon Sep 17 00:00:00 2001 From: servostar Date: Mon, 25 Nov 2024 10:33:12 +0100 Subject: [PATCH 10/10] ci: remove run condition for CI on push on main --- .gitea/workflows/ci.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index bc4eec0..7211b71 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -2,9 +2,6 @@ name: Build'n check run-name: Performing Typst compilation on: push: - pull_request: - branches: - - main jobs: run-ci-linux: runs-on: ubuntu-latest @@ -12,8 +9,7 @@ jobs: # push with commit containing "Run-Checks" if: > (contains(github.event.head_commit.message, 'Run-Checks') && - github.event_name == 'push') || - github.event_name == 'pull_request' + github.event_name == 'push') steps: - name: Check out repository code uses: actions/checkout@v3 -- 2.40.1