From 1f031c050f8d1d613e0087fad250b9b7bb2e8562 Mon Sep 17 00:00:00 2001 From: servostar Date: Sat, 30 Nov 2024 18:16:57 +0100 Subject: [PATCH] ci: update prepare workflow to bake assets on Generate-Assets --- .gitea/workflows/prepare.yml | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/.gitea/workflows/prepare.yml b/.gitea/workflows/prepare.yml index 7dc4eef..9f2a9b4 100644 --- a/.gitea/workflows/prepare.yml +++ b/.gitea/workflows/prepare.yml @@ -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::"