55 lines
1.8 KiB
YAML
55 lines
1.8 KiB
YAML
# Default image for jobs - contains Hugo Extended
|
|
image: klakegg/hugo:ext
|
|
|
|
variables:
|
|
HUGO_ENV: production
|
|
# Define GIT_STRATEGY=none for the deploy job if you don't need the repo fetched again
|
|
# GIT_STRATEGY: none # Uncomment if deploy job doesn't need repo source
|
|
|
|
stages:
|
|
- build # Added build stage
|
|
- deploy
|
|
|
|
# Job to build the Hugo site
|
|
build_site:
|
|
stage: build
|
|
# This job uses the default image (klakegg/hugo:ext)
|
|
script:
|
|
- echo "Starting Hugo build..."
|
|
- hugo version
|
|
- hugo --minify --gc --cleanDestinationDir # Build the site
|
|
- echo "Build completed. Public directory contents:"
|
|
- ls -la public/
|
|
artifacts:
|
|
paths:
|
|
- public/ # Pass the 'public' directory to the next stage
|
|
expire_in: 1 hour # Optional: Set artifact expiry
|
|
# Define when this job runs (e.g., only on the main branch)
|
|
# Adjust 'only' or 'rules' as needed for your workflow
|
|
only:
|
|
- deploy # Example: Run only on the main branch
|
|
|
|
# Job to deploy the built site using cloudron-surfer
|
|
deploy_site:
|
|
stage: deploy
|
|
image: node:18 # Use Node.js image for cloudron-surfer
|
|
needs: # Ensure 'build_site' job completes successfully first
|
|
- job: build_site
|
|
artifacts: true # Download artifacts from 'build_site'
|
|
before_script:
|
|
- echo "Installing cloudron-surfer..."
|
|
- npm install -g cloudron-surfer
|
|
script:
|
|
- echo "Deploying to: $SURFER_SERVER"
|
|
# Verify artifact downloaded correctly
|
|
- echo "Contents of downloaded artifact:"
|
|
- ls -la public/
|
|
- echo "Uploading files to server"
|
|
- surfer put --token $SURFER_TOKEN --server $SURFER_SERVER public/* /
|
|
- echo "Deployment completed successfully"
|
|
# Define when this job runs (e.g., only on the main branch after build)
|
|
# Adjust 'only' or 'rules' as needed for your workflow
|
|
only:
|
|
- deploy # Example: Run only on the main branch
|
|
|