Created
May 7, 2026 14:02
-
-
Save maxfenton/0c85454ed8e26884c889df6aa653c9ee to your computer and use it in GitHub Desktop.
bin/push-content-to-staging
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # Push local content to staging. Defaults to dry run. | |
| # | |
| # Usage: | |
| # bin/push-content-to-staging — dry run | |
| # bin/push-content-to-staging --real — execute | |
| set -euo pipefail | |
| PROJECT_ROOT="$(cd "$(dirname "$0")/.." && pwd)" | |
| if [ -f "$PROJECT_ROOT/.env" ]; then | |
| source "$PROJECT_ROOT/.env" | |
| fi | |
| : "${DEPLOY_USER:?DEPLOY_USER not set — add to .env}" | |
| : "${DEPLOY_HOST:?DEPLOY_HOST not set — add to .env}" | |
| : "${STAGING_PATH:?STAGING_PATH not set — add to .env}" | |
| if [[ "${1:-}" != "--real" ]]; then | |
| echo "DRY RUN — showing what would be pushed to staging (no changes made):" | |
| echo "" | |
| rsync -rlptzv --delete --dry-run \ | |
| "$PROJECT_ROOT/content/" \ | |
| "$DEPLOY_USER@$DEPLOY_HOST:$STAGING_PATH/content/" | |
| echo "" | |
| echo "Run with --real to push these changes to staging." | |
| exit 0 | |
| fi | |
| echo "Pushing content to staging..." | |
| rsync -rlptzv --delete \ | |
| "$PROJECT_ROOT/content/" \ | |
| "$DEPLOY_USER@$DEPLOY_HOST:$STAGING_PATH/content/" | |
| echo "Done." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment