Compare commits
2 Commits
main
...
jekyll-con
Author | SHA1 | Date | |
---|---|---|---|
|
4ba63ae1cf | ||
|
85a627e1ab |
99
.gitea/workflows/deploy-simple.yml
Normal file
99
.gitea/workflows/deploy-simple.yml
Normal file
|
@ -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 "=========================================="
|
||||
|
122
.gitea/workflows/deploy.yml
Normal file
122
.gitea/workflows/deploy.yml
Normal file
|
@ -0,0 +1,122 @@
|
|||
name: Deploy Jekyll Site
|
||||
|
||||
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: Prepare deployment files
|
||||
run: |
|
||||
# Create deployment package
|
||||
tar -czf site-deployment.tar.gz -C _site .
|
||||
|
||||
- name: Deploy to web.resist.is
|
||||
env:
|
||||
DEPLOY_HOST: web.resist.is
|
||||
DEPLOY_USER: resistbot
|
||||
DEPLOY_PASS: ${{ secrets.DEPLOY_PASSWORD }}
|
||||
SITE_PATH: /var/www/join.resist.is
|
||||
run: |
|
||||
# Install sshpass for password authentication
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y sshpass rsync
|
||||
|
||||
# Create backup directory name with timestamp
|
||||
BACKUP_DIR="backup-$(date +%Y%m%d-%H%M%S)"
|
||||
|
||||
# Create SSH config to disable host key checking (for automation)
|
||||
mkdir -p ~/.ssh
|
||||
echo "Host web.resist.is" >> ~/.ssh/config
|
||||
echo " StrictHostKeyChecking no" >> ~/.ssh/config
|
||||
echo " UserKnownHostsFile /dev/null" >> ~/.ssh/config
|
||||
|
||||
# Create backup of existing site
|
||||
echo "Creating backup of existing site..."
|
||||
sshpass -p "$DEPLOY_PASS" ssh "$DEPLOY_USER@$DEPLOY_HOST" "
|
||||
if [ -d '$SITE_PATH' ]; then
|
||||
sudo mkdir -p /var/backups/join.resist.is
|
||||
sudo cp -r '$SITE_PATH' '/var/backups/join.resist.is/$BACKUP_DIR'
|
||||
echo 'Backup created at /var/backups/join.resist.is/$BACKUP_DIR'
|
||||
else
|
||||
echo 'No existing site found to backup'
|
||||
fi
|
||||
"
|
||||
|
||||
# Create site directory if it doesn't exist
|
||||
echo "Preparing deployment directory..."
|
||||
sshpass -p "$DEPLOY_PASS" ssh "$DEPLOY_USER@$DEPLOY_HOST" "
|
||||
sudo mkdir -p '$SITE_PATH'
|
||||
sudo chown -R $DEPLOY_USER:$DEPLOY_USER '$SITE_PATH'
|
||||
"
|
||||
|
||||
# Deploy new site
|
||||
echo "Deploying new Jekyll site..."
|
||||
sshpass -p "$DEPLOY_PASS" rsync -avz --delete \
|
||||
-e "ssh -o StrictHostKeyChecking=no" \
|
||||
_site/ "$DEPLOY_USER@$DEPLOY_HOST:$SITE_PATH/"
|
||||
|
||||
# Set proper permissions
|
||||
sshpass -p "$DEPLOY_PASS" ssh "$DEPLOY_USER@$DEPLOY_HOST" "
|
||||
sudo chown -R www-data:www-data '$SITE_PATH'
|
||||
sudo chmod -R 755 '$SITE_PATH'
|
||||
sudo find '$SITE_PATH' -type f -exec chmod 644 {} \;
|
||||
"
|
||||
|
||||
echo "Deployment completed successfully!"
|
||||
echo "Site is now live at: https://join.resist.is"
|
||||
echo "Backup location: /var/backups/join.resist.is/$BACKUP_DIR"
|
||||
|
||||
- name: Verify deployment
|
||||
env:
|
||||
DEPLOY_HOST: web.resist.is
|
||||
DEPLOY_USER: resistbot
|
||||
DEPLOY_PASS: ${{ secrets.DEPLOY_PASSWORD }}
|
||||
SITE_PATH: /var/www/join.resist.is
|
||||
run: |
|
||||
# Verify the deployment by checking if index.html exists
|
||||
echo "Verifying deployment..."
|
||||
sshpass -p "$DEPLOY_PASS" ssh "$DEPLOY_USER@$DEPLOY_HOST" "
|
||||
if [ -f '$SITE_PATH/index.html' ]; then
|
||||
echo 'Deployment verification successful - index.html found'
|
||||
echo 'File count in deployment:'
|
||||
find '$SITE_PATH' -type f | wc -l
|
||||
else
|
||||
echo 'Deployment verification failed - index.html not found'
|
||||
exit 1
|
||||
fi
|
||||
"
|
||||
|
||||
- name: Cleanup
|
||||
run: |
|
||||
# Remove deployment artifacts
|
||||
rm -f site-deployment.tar.gz
|
||||
echo "Cleanup completed"
|
||||
|
Loading…
Reference in New Issue
Block a user