From c3a05f4cc754a92670c2043bb9a33920fcf6b434 Mon Sep 17 00:00:00 2001 From: Asaf Kali Date: Mon, 18 Dec 2023 13:21:45 +0200 Subject: [PATCH 1/2] Auto commit --- .github/actions/deploy/action.yml | 3 --- .github/workflows/cd.yml | 11 ++++++----- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/actions/deploy/action.yml b/.github/actions/deploy/action.yml index f25dd22..fb91ee2 100644 --- a/.github/actions/deploy/action.yml +++ b/.github/actions/deploy/action.yml @@ -45,9 +45,6 @@ runs: - name: Terraform init run: cd tf; terraform init shell: bash - - name: Build Lambda Layer - run: make build-layer - shell: bash - name: Terraform plan run: make plan WORKSPACE=${{ inputs.workspace }} shell: bash diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 712c7cd..0adf8e4 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -22,7 +22,7 @@ jobs: run: | make test - build-layer: + build-deployment: runs-on: ubuntu-latest steps: - name: Checkout repo @@ -34,14 +34,15 @@ jobs: - name: Install dependencies run: | make install-ci - make install-test - name: Build Lambda Layer run: make build-layer - - name: Upload Lambda Layer + - name: Archive .deployment folder + run: zip -r deployment.zip .deployment + - name: Upload deployment artifact uses: actions/upload-artifact@v2 with: - name: layer - path: layer.zip + name: deployment-${{ github.sha }} + path: deployment.zip deploy-dev: if: ${{ github.ref == 'refs/heads/main' }} From 93fffa3e305a36821151f5a45594dca806329f5b Mon Sep 17 00:00:00 2001 From: Asaf Kali Date: Mon, 18 Dec 2023 13:26:57 +0200 Subject: [PATCH 2/2] Auto commit --- .github/actions/deploy/action.yml | 11 +++++++++++ .github/workflows/cd.yml | 3 +++ 2 files changed, 14 insertions(+) diff --git a/.github/actions/deploy/action.yml b/.github/actions/deploy/action.yml index fb91ee2..7ad5352 100644 --- a/.github/actions/deploy/action.yml +++ b/.github/actions/deploy/action.yml @@ -7,6 +7,9 @@ inputs: description: "The name of the Terraform workspace to use" required: true default: "default" + sha: + description: "The commit SHA to deploy" + required: true aws_access_key_id: description: "AWS access key ID" required: true @@ -39,6 +42,14 @@ runs: echo "sentry_dsn = \"${{ inputs.sentry_dsn }}\"" > ${TF_VAR_FILE} echo "telegram_token = \"${{ inputs.telegram_token }}\"" >> ${TF_VAR_FILE} shell: bash + - name: Download deploy artifact + uses: actions/download-artifact@v2 + with: + name: deployment-${{ inputs.sha }} + path: deployment.zip + - name: Unzip deploy artifact + run: unzip deployment.zip + shell: bash - name: Install CI dependencies run: make install-ci shell: bash diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 0adf8e4..26aa9a6 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -49,6 +49,7 @@ jobs: runs-on: ubuntu-latest needs: - unit-tests + - build-deployment steps: - name: Checkout repo uses: actions/checkout@v2 @@ -56,6 +57,7 @@ jobs: uses: ./.github/actions/deploy with: workspace: default + sha: ${{ github.sha }} aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} aws_region: us-east-1 @@ -95,6 +97,7 @@ jobs: uses: ./.github/actions/deploy with: workspace: prod + sha: ${{ github.sha }} aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} aws_region: us-east-1