From 2963f1f7968f597f2726884b6c96421af37db8fe Mon Sep 17 00:00:00 2001 From: Samuel Adetunji Date: Mon, 23 Sep 2024 02:50:48 -0500 Subject: [PATCH 1/2] Fix cli env update potentially maybe --- .github/workflows/main.yml | 2 +- .github/workflows/predeploy.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 58be3ae..6757e9e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -58,7 +58,7 @@ jobs: - name: ⚗️ Write env variables run: | cd web - echo $(terraform output -raw api-route) > .env + echo NEXT_PUBLIC_APIGW=$(terraform output -raw api-route) > .env - name: 🔨 Build Project run: | diff --git a/.github/workflows/predeploy.yml b/.github/workflows/predeploy.yml index 5f5e96b..6077302 100644 --- a/.github/workflows/predeploy.yml +++ b/.github/workflows/predeploy.yml @@ -60,7 +60,7 @@ jobs: - name: ⚗️ Write env variables run: | cd web - echo $(terraform output -raw api-route) > .env + echo NEXT_PUBLIC_APIGW=$(terraform output -raw api-route) > .env - name: 🔨 Build Project run: | From dff28b61f431cd969d4718996f73f0b5eabb4f2d Mon Sep 17 00:00:00 2001 From: Samuel Adetunji Date: Mon, 23 Sep 2024 03:03:31 -0500 Subject: [PATCH 2/2] Use GH inputs and outputs instead --- .github/workflows/main.yml | 5 ++++- .github/workflows/predeploy.yml | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6757e9e..4d0b1b8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -31,12 +31,15 @@ jobs: - run: echo ${{ steps.plan.outputs.stdout }} - run: echo ${{ steps.plan.outputs.stderr }} - run: echo ${{ steps.plan.outputs.exitcode }} + outputs: + apigw: terraform output -raw api-route web-deploy: name: 💫 Deploy runs-on: ubuntu-latest env: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + APIGW: ${{needs.TF-Apply.outputs.apigw}} needs: ["TF-Apply"] steps: - name: Check Out @@ -58,7 +61,7 @@ jobs: - name: ⚗️ Write env variables run: | cd web - echo NEXT_PUBLIC_APIGW=$(terraform output -raw api-route) > .env + echo NEXT_PUBLIC_APIGW=$APIGW > .env - name: 🔨 Build Project run: | diff --git a/.github/workflows/predeploy.yml b/.github/workflows/predeploy.yml index 6077302..e645f89 100644 --- a/.github/workflows/predeploy.yml +++ b/.github/workflows/predeploy.yml @@ -32,12 +32,15 @@ jobs: - run: echo ${{ steps.plan.outputs.stdout }} - run: echo ${{ steps.plan.outputs.stderr }} - run: echo ${{ steps.plan.outputs.exitcode }} + outputs: + apigw: terraform output -raw api-route web-deploy: name: 💫 Build runs-on: ubuntu-latest env: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + APIGW: ${{needs.TF-Apply.outputs.apigw}} needs: ["TF-Apply"] steps: - name: Check Out @@ -60,7 +63,7 @@ jobs: - name: ⚗️ Write env variables run: | cd web - echo NEXT_PUBLIC_APIGW=$(terraform output -raw api-route) > .env + echo NEXT_PUBLIC_APIGW=$APIGW > .env - name: 🔨 Build Project run: |