diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml index 5bf916b..796b9d7 100644 --- a/.gitea/workflows/deploy.yaml +++ b/.gitea/workflows/deploy.yaml @@ -1,4 +1,4 @@ -name: test +name: Deploy Hugo Site on: push: @@ -6,7 +6,7 @@ on: - deploy jobs: - build: + build-and-deploy: runs-on: 'ubuntu-latest' container: image: klakegg/hugo:ext @@ -14,18 +14,16 @@ jobs: - name: Checkout code uses: actions/checkout@v3 with: - fetch-depth: 0 + fetch-depth: 1 + submodules: recursive # Important if you're using Hugo modules or themes as submodules - - name: Environment Info - run: | - hugo version - pwd - ls -la + - name: Show Hugo version + run: hugo version - - name: Build site + - name: Build site with Hugo run: | - hugo --minify --debug - echo "Build completed, checking output:" + hugo --minify --gc --cleanDestinationDir + echo "Build completed. Public directory contents:" ls -la public/ env: HUGO_ENV: production @@ -35,18 +33,25 @@ jobs: with: node-version: '18' - - name: Install and Deploy with Surfer + - name: Install Surfer run: | - echo "Node version: $(node --version)" - echo "NPM version: $(npm --version)" npm install -g cloudron-surfer - echo "Deploying to server: ${{ secrets.SURFER_SERVER }}" - echo "Files to deploy:" - ls -la public/ - if ! surfer put --token ${{ secrets.SURFER_TOKEN }} --server ${{ secrets.SURFER_SERVER }} public/* /; then - echo "Deployment failed with status $?" - echo "Current directory contents:" - ls -la - exit 1 - fi + 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" \ No newline at end of file