diff --git a/.gitea/workflows/deploy-simple.yml b/.gitea/workflows/deploy-simple.yml new file mode 100644 index 0000000..36ac913 --- /dev/null +++ b/.gitea/workflows/deploy-simple.yml @@ -0,0 +1,99 @@ +name: Deploy Jekyll Site (Simple) + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + types: [ closed ] + +jobs: + deploy: + runs-on: ubuntu-latest + if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.merged == true) + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.0' + bundler-cache: true + + - name: Install dependencies + run: | + gem install bundler + bundle install + + - name: Build Jekyll site + run: | + bundle exec jekyll build + + - name: Create deployment package + run: | + # Create deployment package + tar -czf site-deployment.tar.gz -C _site . + echo "Deployment package created: site-deployment.tar.gz" + echo "Package size: $(du -h site-deployment.tar.gz | cut -f1)" + + - name: List deployment contents + run: | + echo "Contents of _site directory:" + find _site -type f | head -20 + echo "Total files: $(find _site -type f | wc -l)" + + - name: Upload deployment artifact + uses: actions/upload-artifact@v3 + with: + name: jekyll-site + path: site-deployment.tar.gz + retention-days: 30 + + - name: Deployment Instructions + run: | + echo "==========================================" + echo "DEPLOYMENT INSTRUCTIONS" + echo "==========================================" + echo "" + echo "The Jekyll site has been built successfully!" + echo "To deploy to web.resist.is, follow these steps:" + echo "" + echo "1. Download the artifact 'jekyll-site' from this workflow run" + echo "2. Extract site-deployment.tar.gz" + echo "3. Connect to web.resist.is as resistbot user" + echo "4. Create backup: sudo cp -r /var/www/join.resist.is /var/backups/join.resist.is/backup-\$(date +%Y%m%d-%H%M%S)" + echo "5. Deploy files: sudo rsync -av --delete extracted-files/ /var/www/join.resist.is/" + echo "6. Set permissions: sudo chown -R www-data:www-data /var/www/join.resist.is" + echo "7. Set permissions: sudo chmod -R 755 /var/www/join.resist.is" + echo "" + echo "Or use the automated deployment script:" + echo "==========================================" + echo "#!/bin/bash" + echo "# Save this as deploy.sh and run on web.resist.is" + echo "" + echo "SITE_PATH=\"/var/www/join.resist.is\"" + echo "BACKUP_DIR=\"/var/backups/join.resist.is/backup-\$(date +%Y%m%d-%H%M%S)\"" + echo "" + echo "# Create backup" + echo "sudo mkdir -p /var/backups/join.resist.is" + echo "if [ -d \"\$SITE_PATH\" ]; then" + echo " sudo cp -r \"\$SITE_PATH\" \"\$BACKUP_DIR\"" + echo " echo \"Backup created at \$BACKUP_DIR\"" + echo "fi" + echo "" + echo "# Deploy new site" + echo "sudo mkdir -p \"\$SITE_PATH\"" + echo "sudo tar -xzf site-deployment.tar.gz -C \"\$SITE_PATH\"" + echo "" + echo "# Set permissions" + echo "sudo chown -R www-data:www-data \"\$SITE_PATH\"" + echo "sudo chmod -R 755 \"\$SITE_PATH\"" + echo "sudo find \"\$SITE_PATH\" -type f -exec chmod 644 {} \\;" + echo "" + echo "echo \"Deployment completed successfully!\"" + echo "==========================================" +