fixes gitlab ci

This commit is contained in:
Drew
2025-04-16 09:39:02 -06:00
parent a6dc11fd95
commit 3afd80c8b1

View File

@ -1,22 +1,54 @@
# Default image for jobs - contains Hugo Extended
image: klakegg/hugo:ext image: klakegg/hugo:ext
variables: variables:
HUGO_ENV: production 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
deploy: stages:
stage: deploy - build # Added build stage
image: node:18 - deploy
only:
- deploy # Job to build the Hugo site
before_script: build_site:
- npm install -g cloudron-surfer stage: build
# This job uses the default image (klakegg/hugo:ext)
script: script:
- echo "Starting Hugo build..."
- hugo version - hugo version
- hugo --minify --gc --cleanDestinationDir - hugo --minify --gc --cleanDestinationDir # Build the site
- echo "Build completed. Public directory contents:" - echo "Build completed. Public directory contents:"
- ls -la public/ - 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" - echo "Deploying to: $SURFER_SERVER"
- tar -czf deploy.tar.gz -C public . # Verify artifact downloaded correctly
- surfer put --token $SURFER_TOKEN --server $SURFER_SERVER deploy.tar.gz /tmp/deploy.tar.gz - echo "Contents of downloaded artifact:"
- surfer exec --token $SURFER_TOKEN --server $SURFER_SERVER "tar -xzf /tmp/deploy.tar.gz -C / && rm /tmp/deploy.tar.gz" - ls -la public/
- echo "Uploading files to server"
- surfer put --token $SURFER_TOKEN --server $SURFER_SERVER public/* /
- echo "Deployment completed successfully" - 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