Update .gitlab-ci.yml file

This commit is contained in:
2025-07-25 20:40:50 +00:00
parent 49069feddd
commit f6042b91f9

View File

@@ -1,5 +1,6 @@
stages: stages:
- build-and-deploy - build
- deploy
variables: variables:
ZOLA_VERSION: "0.20.0" ZOLA_VERSION: "0.20.0"
@@ -9,8 +10,8 @@ variables:
CUSTOM_DOMAIN: "" CUSTOM_DOMAIN: ""
GIT_SUBMODULE_STRATEGY: none GIT_SUBMODULE_STRATEGY: none
build-and-deploy: build-site:
stage: build-and-deploy stage: build
image: ubuntu:latest image: ubuntu:latest
rules: rules:
- if: $CI_COMMIT_BRANCH == "main" - if: $CI_COMMIT_BRANCH == "main"
@@ -70,9 +71,21 @@ build-and-deploy:
# Copy public folder for GitLab Pages deployment # Copy public folder for GitLab Pages deployment
- cp -r ./template/public . - cp -r ./template/public .
artifacts:
paths:
- public/
expire_in: 1 week
# GitLab Pages deployment job (required name: "pages")
pages:
stage: deploy
image: alpine:latest
dependencies:
- build-site
script:
# Display deployment information # Display deployment information
- | - |
echo "🚀 Deployment completed!" echo "🚀 Deploying to GitLab Pages..."
echo "" echo ""
if [ -n "$CUSTOM_DOMAIN" ]; then if [ -n "$CUSTOM_DOMAIN" ]; then
echo "🌐 Site URLs:" echo "🌐 Site URLs:"
@@ -91,15 +104,15 @@ build-and-deploy:
echo "💡 To enable custom domain:" echo "💡 To enable custom domain:"
echo " Set CUSTOM_DOMAIN variable in CI/CD settings" echo " Set CUSTOM_DOMAIN variable in CI/CD settings"
fi fi
artifacts: artifacts:
paths: paths:
- public/ - public/
expire_in: 1 week rules:
- if: $CI_COMMIT_BRANCH == "main"
# Optional: Manual domain verification job # Optional: Manual domain verification job
verify-domain: verify-domain:
stage: build-and-deploy stage: deploy
image: ubuntu:latest image: ubuntu:latest
script: script:
- apt-get update -qq && apt-get install -y dnsutils curl - apt-get update -qq && apt-get install -y dnsutils curl