build: include site assets

This commit is contained in:
Ming Di Leom 2024-10-06 07:40:09 +00:00
parent c0ee49adca
commit 400cceb783
No known key found for this signature in database
GPG Key ID: 32D3E28E96A695E8
3 changed files with 23 additions and 1 deletions

View File

@ -5,6 +5,9 @@ on:
branches:
- master
env:
NODE_ENV: production
jobs:
build:
runs-on: ubuntu-latest

19
build.sh Normal file
View File

@ -0,0 +1,19 @@
#!/bin/sh
if ! (set -o pipefail 2>/dev/null); then
# dash does not support pipefail
set -ex
else
set -ex -o pipefail
fi
export PATH="$PATH:./node_modules/.bin"
hexo generate
# deploy site assets
if [ "$NODE_ENV" = "production" ] && [ -d "public/" ]; then
git clone --depth 1 --branch site https://gitlab.com/curben/blog.git site
cp -r site/* "public/"
rm -f "public/README.md"
fi

View File

@ -6,7 +6,7 @@
"version": "7.3.0"
},
"scripts": {
"build": "hexo generate",
"build": "sh build.sh",
"snyk": "snyk auth $SNYK_TOKEN && snyk-protect && snyk test && snyk monitor",
"renovate": "renovate --platform 'gitlab' --autodiscover false --onboarding false --update-lock-files false --labels 'renovate' --require-config='ignored' \"$CI_PROJECT_PATH\"",
"deploy-cf-images": "npx wrangler deploy"