low the fetch depth
Some checks failed
Deploy Hugo Site / build-and-deploy (push) Has been cancelled
Some checks failed
Deploy Hugo Site / build-and-deploy (push) Has been cancelled
This commit is contained in:
@ -1,4 +1,4 @@
|
|||||||
name: test
|
name: Deploy Hugo Site
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@ -6,7 +6,7 @@ on:
|
|||||||
- deploy
|
- deploy
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build-and-deploy:
|
||||||
runs-on: 'ubuntu-latest'
|
runs-on: 'ubuntu-latest'
|
||||||
container:
|
container:
|
||||||
image: klakegg/hugo:ext
|
image: klakegg/hugo:ext
|
||||||
@ -14,18 +14,16 @@ jobs:
|
|||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 1
|
||||||
|
submodules: recursive # Important if you're using Hugo modules or themes as submodules
|
||||||
|
|
||||||
- name: Environment Info
|
- name: Show Hugo version
|
||||||
run: |
|
run: hugo version
|
||||||
hugo version
|
|
||||||
pwd
|
|
||||||
ls -la
|
|
||||||
|
|
||||||
- name: Build site
|
- name: Build site with Hugo
|
||||||
run: |
|
run: |
|
||||||
hugo --minify --debug
|
hugo --minify --gc --cleanDestinationDir
|
||||||
echo "Build completed, checking output:"
|
echo "Build completed. Public directory contents:"
|
||||||
ls -la public/
|
ls -la public/
|
||||||
env:
|
env:
|
||||||
HUGO_ENV: production
|
HUGO_ENV: production
|
||||||
@ -35,18 +33,25 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
node-version: '18'
|
node-version: '18'
|
||||||
|
|
||||||
- name: Install and Deploy with Surfer
|
- name: Install Surfer
|
||||||
run: |
|
run: |
|
||||||
echo "Node version: $(node --version)"
|
|
||||||
echo "NPM version: $(npm --version)"
|
|
||||||
npm install -g cloudron-surfer
|
npm install -g cloudron-surfer
|
||||||
echo "Deploying to server: ${{ secrets.SURFER_SERVER }}"
|
surfer --version
|
||||||
echo "Files to deploy:"
|
|
||||||
ls -la public/
|
- name: Deploy to Surfer
|
||||||
if ! surfer put --token ${{ secrets.SURFER_TOKEN }} --server ${{ secrets.SURFER_SERVER }} public/* /; then
|
run: |
|
||||||
echo "Deployment failed with status $?"
|
echo "Deploying to: ${{ secrets.SURFER_SERVER }}"
|
||||||
echo "Current directory contents:"
|
# Create a tar archive for more reliable transfer
|
||||||
ls -la
|
tar -czf deploy.tar.gz -C public .
|
||||||
exit 1
|
|
||||||
fi
|
# 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"
|
echo "Deployment completed successfully"
|
Reference in New Issue
Block a user