Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
4 changes: 4 additions & 0 deletions docs/operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 3 additions & 0 deletions scripts/test-deploy-workflow.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Loading