adds gitlab ci

This commit is contained in:
Drew
2025-04-16 09:18:12 -06:00
parent 85cac93f19
commit a6dc11fd95
2 changed files with 22 additions and 57 deletions

View File

@ -1,57 +0,0 @@
name: Deploy Hugo Site
on:
push:
branches:
- deploy
jobs:
build-and-deploy:
runs-on: 'ubuntu-latest'
container:
image: klakegg/hugo:ext
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 1
submodules: recursive # Important if you're using Hugo modules or themes as submodules
- name: Show Hugo version
run: hugo version
- name: Build site with Hugo
run: |
hugo --minify --gc --cleanDestinationDir
echo "Build completed. Public directory contents:"
ls -la public/
env:
HUGO_ENV: production
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install Surfer
run: |
npm install -g cloudron-surfer
surfer --version
- name: Deploy to Surfer
run: |
echo "Deploying to: ${{ secrets.SURFER_SERVER }}"
# Create a tar archive for more reliable transfer
tar -czf deploy.tar.gz -C public .
# Deploy using Surfer
surfer put --token ${{ secrets.SURFER_TOKEN }} \
--server ${{ secrets.SURFER_SERVER }} \
deploy.tar.gz /tmp/deploy.tar.gz
# Extract on remote server
surfer exec --token ${{ secrets.SURFER_TOKEN }} \
--server ${{ secrets.SURFER_SERVER }} \
"tar -xzf /tmp/deploy.tar.gz -C / && rm /tmp/deploy.tar.gz"
echo "Deployment completed successfully"

22
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,22 @@
image: klakegg/hugo:ext
variables:
HUGO_ENV: production
deploy:
stage: deploy
image: node:18
only:
- deploy
before_script:
- npm install -g cloudron-surfer
script:
- hugo version
- hugo --minify --gc --cleanDestinationDir
- echo "Build completed. Public directory contents:"
- ls -la public/
- echo "Deploying to: $SURFER_SERVER"
- tar -czf deploy.tar.gz -C public .
- surfer put --token $SURFER_TOKEN --server $SURFER_SERVER deploy.tar.gz /tmp/deploy.tar.gz
- surfer exec --token $SURFER_TOKEN --server $SURFER_SERVER "tar -xzf /tmp/deploy.tar.gz -C / && rm /tmp/deploy.tar.gz"
- echo "Deployment completed successfully"