From b618ab0864bdece039b92c122742577725fe68cc Mon Sep 17 00:00:00 2001 From: Terraform Date: Wed, 15 Apr 2026 02:54:33 +0000 Subject: [PATCH 01/12] Add production release CICD --- .github/workflows/aws_prod_release.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/aws_prod_release.yml b/.github/workflows/aws_prod_release.yml index 664027e..c74ee5e 100644 --- a/.github/workflows/aws_prod_release.yml +++ b/.github/workflows/aws_prod_release.yml @@ -52,7 +52,16 @@ jobs: - run: git config --global user.name Devops - run: npm version --no-git-tag-version ${{ github.event.release.tag_name }} - run: npm i - - run: CI=false npm run build + - name: Build + run: | + set +e + CI=false npm run build 2>&1 | tee /tmp/build.log + BUILD_EXIT=${PIPESTATUS[0]} + set -e + if [ $BUILD_EXIT -ne 0 ] || grep -q "npm ERR!" /tmp/build.log; then + echo "::error::Build failed" + exit 1 + fi - name: Set up QEMU uses: docker/setup-qemu-action@v3.0.0 From ea2f0ffa9d175ac37cd1ebb1a9660a267d3b714d Mon Sep 17 00:00:00 2001 From: Terraform Date: Wed, 15 Apr 2026 02:56:41 +0000 Subject: [PATCH 02/12] Add production release CICD --- .github/workflows/aws_dev_release.yml | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/.github/workflows/aws_dev_release.yml b/.github/workflows/aws_dev_release.yml index 602a41e..6d088c2 100644 --- a/.github/workflows/aws_dev_release.yml +++ b/.github/workflows/aws_dev_release.yml @@ -48,19 +48,28 @@ jobs: node-version: 20.10 cache: 'npm' - run: npm i - - run: CI=false npm run build - + - name: Build + run: | + set +e + CI=false npm run build 2>&1 | tee /tmp/build.log + BUILD_EXIT=${PIPESTATUS[0]} + set -e + if [ $BUILD_EXIT -ne 0 ] || grep -q "npm ERR!" /tmp/build.log; then + echo "::error::Build failed" + exit 1 + fi + - name: Set up QEMU uses: docker/setup-qemu-action@v3 with: platforms: arm64,amd64 - + - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v4 with: role-to-assume: arn:aws:iam::368076259134:role/github-actions-role aws-region: us-east-1 - + - name: Login to Amazon ECR id: login-ecr uses: aws-actions/amazon-ecr-login@v2 @@ -79,7 +88,7 @@ jobs: tags: | type=raw,value=${{ github.event.repository.name }} - + - name: Build and push multi-platform images to ECR uses: docker/build-push-action@v5 From bd3ef38c69be5f32f1ff23b26de20981df5f51bb Mon Sep 17 00:00:00 2001 From: notchjpl <128665993+notchjpl@users.noreply.github.com> Date: Wed, 15 Apr 2026 15:09:07 -0300 Subject: [PATCH 03/12] Update base image to Node.js 22-alpine --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index dbb3959..1aeccbb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM --platform=linux/arm64 node:20.10-alpine3.19 +FROM node:22-alpine WORKDIR /app ADD build ./build ADD package* ./ From 384f3000bbabda68deb27b077009cb8130bab4e6 Mon Sep 17 00:00:00 2001 From: Terraform Date: Wed, 15 Apr 2026 20:22:36 +0000 Subject: [PATCH 04/12] Add production release CICD --- .github/workflows/aws_prod_release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/aws_prod_release.yml b/.github/workflows/aws_prod_release.yml index c74ee5e..cb9e7d0 100644 --- a/.github/workflows/aws_prod_release.yml +++ b/.github/workflows/aws_prod_release.yml @@ -46,7 +46,7 @@ jobs: - uses: actions/setup-node@v4 with: - node-version: 20.10 + node-version: ${{ vars.node_version }} cache: 'npm' - run: git config --global user.email devops@topia.io - run: git config --global user.name Devops @@ -71,7 +71,7 @@ jobs: - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v4 with: - role-to-assume: arn:aws:iam::368076259134:role/github-actions-role + role-to-assume: ${{ fromJSON(secrets.AWS_ROLE_ARN).prod }} aws-region: us-east-1 - name: Login to Amazon ECR @@ -118,7 +118,7 @@ jobs: - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v4 with: - role-to-assume: arn:aws:iam::471112828260:role/github-actions-role + role-to-assume: ${{ fromJSON(secrets.AWS_ROLE_ARN).prod }} aws-region: us-east-1 - name: deploy From b533180130b9be7ef6b4f1b8f1d618ad5e33469f Mon Sep 17 00:00:00 2001 From: Terraform Date: Wed, 15 Apr 2026 20:23:40 +0000 Subject: [PATCH 05/12] Fix release workflow to trigger production deployment --- .github/workflows/aws_auto_release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/aws_auto_release.yml b/.github/workflows/aws_auto_release.yml index f536d63..5524e16 100644 --- a/.github/workflows/aws_auto_release.yml +++ b/.github/workflows/aws_auto_release.yml @@ -155,7 +155,7 @@ jobs: if: steps.auth_check.outputs.is_authorized == 'true' && steps.check.outputs.should_release == 'true' uses: actions/setup-node@v4 with: - node-version: 20.10 + node-version: ${{ vars.node_version }} - name: Calculate new version with cumulative bumps if: steps.auth_check.outputs.is_authorized == 'true' && steps.check.outputs.should_release == 'true' From 96963a9ae85b22b621eb42380414306102dd13ba Mon Sep 17 00:00:00 2001 From: Terraform Date: Wed, 15 Apr 2026 20:24:05 +0000 Subject: [PATCH 06/12] Add production release CICD --- .github/workflows/aws_dev_release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/aws_dev_release.yml b/.github/workflows/aws_dev_release.yml index 6d088c2..e5f079b 100644 --- a/.github/workflows/aws_dev_release.yml +++ b/.github/workflows/aws_dev_release.yml @@ -45,7 +45,7 @@ jobs: - uses: actions/setup-node@v4 with: - node-version: 20.10 + node-version: ${{ vars.node_version }} cache: 'npm' - run: npm i - name: Build @@ -67,7 +67,7 @@ jobs: - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v4 with: - role-to-assume: arn:aws:iam::368076259134:role/github-actions-role + role-to-assume: ${{ fromJSON(secrets.AWS_ROLE_ARN).dev }} aws-region: us-east-1 - name: Login to Amazon ECR @@ -115,7 +115,7 @@ jobs: - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v4 with: - role-to-assume: arn:aws:iam::368076259134:role/github-actions-role + role-to-assume: ${{ fromJSON(secrets.AWS_ROLE_ARN).dev }} aws-region: us-east-1 - name: deploy From 6d267c7d0471373466daff97a0e3b4005712b62f Mon Sep 17 00:00:00 2001 From: Terraform Date: Wed, 15 Apr 2026 21:26:59 +0000 Subject: [PATCH 07/12] Add production release CICD --- .github/workflows/aws_prod_release.yml | 30 ++++++++++++++++++++------ 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/.github/workflows/aws_prod_release.yml b/.github/workflows/aws_prod_release.yml index cb9e7d0..9750314 100644 --- a/.github/workflows/aws_prod_release.yml +++ b/.github/workflows/aws_prod_release.yml @@ -62,18 +62,26 @@ jobs: echo "::error::Build failed" exit 1 fi - + - name: Set up QEMU uses: docker/setup-qemu-action@v3.0.0 with: platforms: arm64,amd64 - + + - name: Get role ARN + id: get_role + env: + ARN_JSON: ${{ secrets.AWS_ROLE_ARN }} + run: | + arn=$(echo "$ARN_JSON" | jq -r '.dev') + echo "::add-mask::$arn" + echo "arn=$arn" >> $GITHUB_OUTPUT - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v4 with: - role-to-assume: ${{ fromJSON(secrets.AWS_ROLE_ARN).prod }} + role-to-assume: ${{ steps.get_role.outputs.arn }} aws-region: us-east-1 - + - name: Login to Amazon ECR id: login-ecr uses: aws-actions/amazon-ecr-login@v2 @@ -115,13 +123,21 @@ jobs: matrix: service: ${{ fromJson(needs.Build.outputs.service) }} steps: + - name: Get role ARN + id: get_role + env: + ARN_JSON: ${{ secrets.AWS_ROLE_ARN }} + run: | + arn=$(echo "$ARN_JSON" | jq -r '.prod') + echo "::add-mask::$arn" + echo "arn=$arn" >> $GITHUB_OUTPUT - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v4 with: - role-to-assume: ${{ fromJSON(secrets.AWS_ROLE_ARN).prod }} + role-to-assume: ${{ steps.get_role.outputs.arn }} aws-region: us-east-1 - name: deploy run: | - aws ecs update-service --cluster ${{ env.ECS_Cluster }} --service topia-${{ env.ENV }}-${{ matrix.service }}0 --force-new-deployment - + aws ecs update-service --cluster ${{ env.ECS_Cluster }} --service topia-${{ env.ENV }}-${{ matrix.service }}0 --force-new-deployment + From 309600638fd33fb1b735136d5b315000899da2ac Mon Sep 17 00:00:00 2001 From: Terraform Date: Wed, 15 Apr 2026 21:27:56 +0000 Subject: [PATCH 08/12] Add production release CICD --- .github/workflows/aws_dev_release.yml | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/.github/workflows/aws_dev_release.yml b/.github/workflows/aws_dev_release.yml index e5f079b..520d06e 100644 --- a/.github/workflows/aws_dev_release.yml +++ b/.github/workflows/aws_dev_release.yml @@ -64,10 +64,18 @@ jobs: with: platforms: arm64,amd64 + - name: Get role ARN + id: get_role + env: + ARN_JSON: ${{ secrets.AWS_ROLE_ARN }} + run: | + arn=$(echo "$ARN_JSON" | jq -r '.dev') + echo "::add-mask::$arn" + echo "arn=$arn" >> $GITHUB_OUTPUT - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v4 with: - role-to-assume: ${{ fromJSON(secrets.AWS_ROLE_ARN).dev }} + role-to-assume: ${{ steps.get_role.outputs.arn }} aws-region: us-east-1 - name: Login to Amazon ECR @@ -112,10 +120,18 @@ jobs: matrix: service: ${{ fromJson(needs.Build.outputs.service) }} steps: + - name: Get role ARN + id: get_role + env: + ARN_JSON: ${{ secrets.AWS_ROLE_ARN }} + run: | + arn=$(echo "$ARN_JSON" | jq -r '.dev') + echo "::add-mask::$arn" + echo "arn=$arn" >> $GITHUB_OUTPUT - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v4 with: - role-to-assume: ${{ fromJSON(secrets.AWS_ROLE_ARN).dev }} + role-to-assume: ${{ steps.get_role.outputs.arn }} aws-region: us-east-1 - name: deploy From 37f775021905b27d2873da455a15667f3c7ad544 Mon Sep 17 00:00:00 2001 From: Lina Date: Wed, 15 Apr 2026 18:54:25 -0700 Subject: [PATCH 09/12] remove unnecessary error logging --- src/controllers/handleDropPiece.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/controllers/handleDropPiece.ts b/src/controllers/handleDropPiece.ts index d266053..720525c 100644 --- a/src/controllers/handleDropPiece.ts +++ b/src/controllers/handleDropPiece.ts @@ -99,7 +99,7 @@ export const handleDropPiece = async (req: Request, res: Response) => { const gameText = droppedAssets[0]; if (!shouldUpdateGame) { if (gameText) await gameText.updateCustomTextAsset({}, text); - throw text; + return console.log("Drop piece invalid: ", text); } const promises = []; From 2488311e5cbbbf6aacd3ffc579db9a5fee6a2245 Mon Sep 17 00:00:00 2001 From: Lina Date: Thu, 23 Apr 2026 10:21:04 -0700 Subject: [PATCH 10/12] add additional error handling --- src/controllers/handlePlayerSelection.ts | 33 +++++++++++++++++++++--- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/src/controllers/handlePlayerSelection.ts b/src/controllers/handlePlayerSelection.ts index 6ced770..2716519 100644 --- a/src/controllers/handlePlayerSelection.ts +++ b/src/controllers/handlePlayerSelection.ts @@ -64,8 +64,15 @@ export const handlePlayerSelection = async (req: Request, res: Response) => { const playerText = droppedAssets.find((droppedAsset) => droppedAsset.uniqueName === `player${playerId}Text`); if (!shouldUpdateGame) { - if (gameText) gameText.updateCustomTextAsset({}, text); - throw text; + if (gameText) + await gameText.updateCustomTextAsset({}, text).catch((error) => + errorHandler({ + error, + functionName: "handlePlayerSelection", + message: "Error updating game text asset", + }), + ); + return console.warn(text); } const promises = []; @@ -81,8 +88,26 @@ export const handlePlayerSelection = async (req: Request, res: Response) => { }, ), ); - if (playerText) promises.push(playerText.updateCustomTextAsset({}, username)); - if (gameText) promises.push(gameText.updateCustomTextAsset({}, text)); + if (playerText) + promises.push( + playerText.updateCustomTextAsset({}, username).catch((error) => + errorHandler({ + error, + functionName: "handlePlayerSelection", + message: "Error updating player text asset", + }), + ), + ); + if (gameText) + promises.push( + gameText.updateCustomTextAsset({}, text).catch((error) => + errorHandler({ + error, + functionName: "handlePlayerSelection", + message: "Error updating game text asset", + }), + ), + ); await Promise.all(promises); } catch (error) { await keyAsset.updateDataObject({ playerCount: playerCount + 1 }); From 3c8cf160bd1e174a4e56f760eaba0543aa86a07d Mon Sep 17 00:00:00 2001 From: Lina Date: Thu, 23 Apr 2026 10:25:04 -0700 Subject: [PATCH 11/12] add additional error handling --- src/controllers/handleDropPiece.ts | 20 ++++++++++++++++++-- src/controllers/handlePlayerSelection.ts | 2 +- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/controllers/handleDropPiece.ts b/src/controllers/handleDropPiece.ts index 720525c..17c4383 100644 --- a/src/controllers/handleDropPiece.ts +++ b/src/controllers/handleDropPiece.ts @@ -98,7 +98,14 @@ export const handleDropPiece = async (req: Request, res: Response) => { const gameText = droppedAssets[0]; if (!shouldUpdateGame) { - if (gameText) await gameText.updateCustomTextAsset({}, text); + if (gameText) + await gameText.updateCustomTextAsset({}, text).catch((error) => + errorHandler({ + error, + functionName: "handleDropPiece", + message: "Error updating game text asset", + }), + ); return console.log("Drop piece invalid: ", text); } @@ -196,7 +203,16 @@ export const handleDropPiece = async (req: Request, res: Response) => { } promises.push(keyAsset.updateDataObject(updatedData, { analytics })); - if (gameText) promises.push(gameText.updateCustomTextAsset({}, text)); + if (gameText) + promises.push( + gameText.updateCustomTextAsset({}, text).catch((error) => + errorHandler({ + error, + functionName: "handleDropPiece", + message: "Error updating game text asset", + }), + ), + ); await Promise.all(promises); } catch (error) { diff --git a/src/controllers/handlePlayerSelection.ts b/src/controllers/handlePlayerSelection.ts index 2716519..fed680e 100644 --- a/src/controllers/handlePlayerSelection.ts +++ b/src/controllers/handlePlayerSelection.ts @@ -72,7 +72,7 @@ export const handlePlayerSelection = async (req: Request, res: Response) => { message: "Error updating game text asset", }), ); - return console.warn(text); + return console.log("Player selection invalid: ", text); } const promises = []; From 4fefa646b39fca9bcd524304e19e696ea6d75a35 Mon Sep 17 00:00:00 2001 From: Lina Date: Thu, 23 Apr 2026 10:44:07 -0700 Subject: [PATCH 12/12] update data object on error --- src/controllers/handleDropPiece.ts | 4 +++- src/controllers/handlePlayerSelection.ts | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/controllers/handleDropPiece.ts b/src/controllers/handleDropPiece.ts index 17c4383..00df6e1 100644 --- a/src/controllers/handleDropPiece.ts +++ b/src/controllers/handleDropPiece.ts @@ -98,7 +98,7 @@ export const handleDropPiece = async (req: Request, res: Response) => { const gameText = droppedAssets[0]; if (!shouldUpdateGame) { - if (gameText) + if (gameText) { await gameText.updateCustomTextAsset({}, text).catch((error) => errorHandler({ error, @@ -106,6 +106,8 @@ export const handleDropPiece = async (req: Request, res: Response) => { message: "Error updating game text asset", }), ); + } + await keyAsset.updateDataObject({ turnCount: turnCount + 1 }); return console.log("Drop piece invalid: ", text); } diff --git a/src/controllers/handlePlayerSelection.ts b/src/controllers/handlePlayerSelection.ts index fed680e..1c1352d 100644 --- a/src/controllers/handlePlayerSelection.ts +++ b/src/controllers/handlePlayerSelection.ts @@ -64,7 +64,7 @@ export const handlePlayerSelection = async (req: Request, res: Response) => { const playerText = droppedAssets.find((droppedAsset) => droppedAsset.uniqueName === `player${playerId}Text`); if (!shouldUpdateGame) { - if (gameText) + if (gameText) { await gameText.updateCustomTextAsset({}, text).catch((error) => errorHandler({ error, @@ -72,6 +72,8 @@ export const handlePlayerSelection = async (req: Request, res: Response) => { message: "Error updating game text asset", }), ); + } + await keyAsset.updateDataObject({ playerCount: playerCount + 1 }); return console.log("Player selection invalid: ", text); }