@@ -38,53 +38,57 @@ jobs:
3838 git commit -m "Deploy $GITHUB_SHA to gh-pages"
3939 git push --force --set-upstream origin gh-pages
4040
41- - name : Setup AWS CLI
41+ - name : Install and Configure s3cmd
4242 run : |
43- pip install awscli
44- mkdir -p ~/.aws
45- echo "[default]" > ~/.aws/credentials
46- echo "aws_access_key_id = ${{ secrets.S3_ACCESS_KEY }}" >> ~/.aws/credentials
47- echo "aws_secret_access_key = ${{ secrets.S3_SECRET_KEY }}" >> ~/.aws/credentials
48- echo "[default]" > ~/.aws/config
49- echo "region = ${{ secrets.S3_REGION }}" >> ~/.aws/config
43+ # Install s3cmd
44+ pip install s3cmd
5045
51- - name : Deploy to S3-compatible storage with progress
46+ # Extract domain from endpoint URL (remove https:// if present)
47+ ENDPOINT=$(echo "${{ secrets.S3_ENDPOINT_URL }}" | sed 's/https:\/\///')
48+
49+ # Create s3cmd config file
50+ cat > ~/.s3cfg << EOF
51+ [default]
52+ access_key = ${{ secrets.S3_ACCESS_KEY }}
53+ secret_key = ${{ secrets.S3_SECRET_KEY }}
54+ host_base = ${ENDPOINT}
55+ host_bucket = ${ENDPOINT}
56+ use_https = True
57+ check_ssl_certificate = False
58+ check_ssl_hostname = False
59+ # Enable verbose output and progress meter
60+ verbose = True
61+ progress_meter = True
62+ EOF
63+
64+ - name : Deploy to S3-compatible storage with s3cmd
5265 run : |
5366 # Navigate to where the built files are
5467 cd gh-pages
5568
56- # Print bucket name for verification (with secrets masked)
57- echo "Using bucket: ${S3_BUCKET_NAME_MASKED} "
58- echo "Using endpoint : ${S3_ENDPOINT_URL_MASKED }"
69+ # Print info about deployment
70+ echo "Using s3cmd to upload to S3-compatible storage "
71+ echo "Bucket : ${S3_BUCKET_NAME_MASKED }"
5972
60- # Verify bucket exists
61- echo "Verifying bucket exists..."
62- if aws s3 ls "s3://${{ secrets.S3_BUCKET_NAME }}/" \
63- --endpoint-url=${{ secrets.S3_ENDPOINT_URL }} \
64- --no-verify-ssl; then
73+ # Test bucket access
74+ echo "Testing bucket access..."
75+ if s3cmd ls s3://${{ secrets.S3_BUCKET_NAME }}/; then
6576 echo "✅ Bucket exists and is accessible"
6677 else
6778 echo "❌ Bucket does not exist or is not accessible"
6879 exit 1
6980 fi
7081
71- # First, remove all existing files in the bucket to ensure clean deployment
82+ # First, remove all existing files in the bucket
7283 echo "Clearing existing files from bucket..."
73- aws s3 rm "s3://${{ secrets.S3_BUCKET_NAME }}/" \
74- --recursive \
75- --endpoint-url=${{ secrets.S3_ENDPOINT_URL }} \
76- --no-verify-ssl
84+ s3cmd del --recursive --force s3://${{ secrets.S3_BUCKET_NAME }}/
7785
78- # Sync all files to S3 bucket with progress reporting
86+ # Upload all files with progress display
7987 echo "Uploading files to S3-compatible storage..."
80- aws s3 sync . "s3://${{ secrets.S3_BUCKET_NAME }}/" \
81- --exclude ".git/*" \
82- --endpoint-url=${{ secrets.S3_ENDPOINT_URL }} \
83- --no-verify-ssl \
84- --debug
88+ s3cmd sync --verbose --progress --exclude=".git/*" \
89+ --no-check-md5 ./ s3://${{ secrets.S3_BUCKET_NAME }}/
8590
8691 echo "Successfully deployed to S3-compatible storage"
8792 env :
88- # Mask sensitive data in logs but still make output readable
93+ # Mask sensitive data in logs
8994 S3_BUCKET_NAME_MASKED : " ${{ secrets.S3_BUCKET_NAME }}"
90- S3_ENDPOINT_URL_MASKED : " ${{ secrets.S3_ENDPOINT_URL }}"
0 commit comments