From 1107a08a1c2b8638b4b5c5e6025ea1b2cd315113 Mon Sep 17 00:00:00 2001 From: Brandon Rozek Date: Sun, 28 Jul 2024 19:59:08 -0700 Subject: [PATCH] Prebuild script --- .github/workflows/deploy.yml | 7 +++---- build.sh | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 build.sh diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 603ef90..216735d 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -44,15 +44,14 @@ jobs: sudo apt update sudo apt install -y rustc cargo - - name: Build + - name: Build Website-Toots run: | cd content/toots/.scripts cargo build --release - - name: Generate Hugo Markdown for Toots + - name: Pre-build script run: | - cd content/toots/.scripts - ./target/release/generate_md + ./build.sh - name: Build Hugo Website id: build diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..0a87820 --- /dev/null +++ b/build.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env sh + +# Generate toot markdown files + +pushd content/toots/.scripts > /dev/null + +generate_exe="./target/release/generate_md" + +# Check if the file exists and is executable +if [ -e "$generate_exe" ] && [ -x "$generate_exe" ]; then + echo "The file '$file_path' exists and is executable." + ./target/release/generate_md +else + echo "The executable '$generate_exe' does not exist." + echo "Perhaps run cargo build in 'content/toots/.scripts'?" +fi + +popd > /dev/null