diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index c6a8e1a..776346a 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -68,11 +68,17 @@ jobs: env: IMAGE_REPOSITORY: ghcr.io/${{ github.repository }} SOURCE_SHA: ${{ needs.resolve.outputs.source_sha }} + REACT_APP_WCA_CLIENT_ID: ${{ vars.REACT_APP_WCA_CLIENT_ID }} run: | + if [[ -z "$REACT_APP_WCA_CLIENT_ID" ]]; then + echo "Set the REACT_APP_WCA_CLIENT_ID repository variable before deploying." >&2 + exit 1 + fi IMAGE_TAG="${IMAGE_REPOSITORY,,}:$SOURCE_SHA" for attempt in 1 2 3; do if docker buildx build . \ --build-arg "SOURCE_SHA=$SOURCE_SHA" \ + --build-arg REACT_APP_WCA_CLIENT_ID \ --cache-from type=gha,scope=production-image \ --cache-to type=gha,mode=max,scope=production-image \ --metadata-file /tmp/build-metadata.json \ diff --git a/docs/operations.md b/docs/operations.md index 07cf1c5..6524429 100644 --- a/docs/operations.md +++ b/docs/operations.md @@ -31,6 +31,10 @@ The repository needs these GitHub Actions secrets: - `DEPLOY_SSH_KEY`: the private key for the `www` account. - `DEPLOY_KNOWN_HOSTS`: the pinned SSH host key entry. +Set the GitHub Actions repository variable `REACT_APP_WCA_CLIENT_ID` to the +public application ID. Use the same value as `WCA_CLIENT_ID` on the production +server. The workflow requires this variable to build the login link. + The server needs Docker access for `www`, the production `.env.prod` file at `/home/www/letscube`, and the existing certificate directories. Actions stores runtime Compose files in `/opt/letscube/runtime`, outside the old Git checkout. diff --git a/scripts/test-deploy-workflow.sh b/scripts/test-deploy-workflow.sh index 7503218..3365f75 100755 --- a/scripts/test-deploy-workflow.sh +++ b/scripts/test-deploy-workflow.sh @@ -21,6 +21,9 @@ assert_contains "$WORKFLOW" 'workflows: [CI]' assert_contains "$WORKFLOW" 'branches: [master]' assert_contains "$WORKFLOW" "github.event.workflow_run.conclusion == 'success'" assert_contains "$WORKFLOW" 'IMAGE_TAG="${IMAGE_REPOSITORY,,}:$SOURCE_SHA"' +assert_contains "$WORKFLOW" 'REACT_APP_WCA_CLIENT_ID: ${{ vars.REACT_APP_WCA_CLIENT_ID }}' +assert_contains "$WORKFLOW" 'if [[ -z "$REACT_APP_WCA_CLIENT_ID" ]]; then' +assert_contains "$WORKFLOW" '--build-arg REACT_APP_WCA_CLIENT_ID' assert_contains "$WORKFLOW" 'IMAGE_REPOSITORY="${IMAGE_REPOSITORY,,}"' assert_contains "$WORKFLOW" 'image_ref=$IMAGE_REPOSITORY@$IMAGE_DIGEST' assert_contains "$WORKFLOW" 'for attempt in 1 2 3; do'