Skip to content

Self-hosted personal gallery application with online photo management and albums, supporting Live/Motion Photos, EXIF parsing, geolocation recognition, and an explore map.

chore(ci): add manual environment secret synchronization

Timothy Yindd4ddd5d00fe
diff --git a/.github/workflows/sync-platform-secrets.yml b/.github/workflows/sync-platform-secrets.yml
new file mode 100644
index 00000000..5e8486e3
--- /dev/null
+++ b/.github/workflows/sync-platform-secrets.yml
@@ -0,0 +1,50 @@
+name: Sync platform secrets
+
+on:
+ workflow_dispatch:
+ inputs:
+ target_repository:
+ description: Destination repository (owner/name)
+ type: string
+ required: true
+ target_environment:
+ description: Existing destination environment
+ type: string
+ required: true
+
+permissions: {}
+
+concurrency:
+ group: platform-secrets-sync
+ cancel-in-progress: false
+
+jobs:
+ sync:
+ runs-on: ubuntu-24.04
+ environment: saas-production
+ steps:
+ - name: Validate destination and copy existing secrets
+ env:
+ GH_TOKEN: ${{ secrets.ADMIN_SECRETS_SYNC_TOKEN }}
+ AUTH_VALUE: ${{ secrets.CLOUD_PLATFORM_SECRET }}
+ STORAGE_VALUE: ${{ secrets.PLATFORM_STORAGE_SECRET }}
+ TARGET_REPOSITORY: ${{ inputs.target_repository }}
+ TARGET_ENVIRONMENT: ${{ inputs.target_environment }}
+ shell: bash
+ run: |
+ set -euo pipefail
+ if [[ -z "$GH_TOKEN" || -z "$AUTH_VALUE" || -z "$STORAGE_VALUE" ]]; then
+ echo '::error::Configure the temporary destination token and both production source secrets.'
+ exit 1
+ fi
+ if [[ ! "$TARGET_REPOSITORY" =~ ^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$ || ! "$TARGET_ENVIRONMENT" =~ ^[A-Za-z0-9_-]+$ ]]; then
+ echo '::error::Invalid destination repository or environment.'
+ exit 1
+ fi
+ # Require an existing environment; never silently create an unprotected one.
+ gh api "repos/$TARGET_REPOSITORY/environments/$TARGET_ENVIRONMENT" > /dev/null
+ printf '%s' "$AUTH_VALUE" | gh secret set NUXT_AUTH_SECRET \
+ --repo "$TARGET_REPOSITORY" --env "$TARGET_ENVIRONMENT"
+ printf '%s' "$STORAGE_VALUE" | gh secret set NUXT_STORAGE_SECRET \
+ --repo "$TARGET_REPOSITORY" --env "$TARGET_ENVIRONMENT"
+ echo 'Copied both existing secrets. Source values were not changed.'