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"