Skip to content

Commit

Permalink
Merge pull request #10 from asaf-kali/cicd
Browse files Browse the repository at this point in the history
CICD fixes
  • Loading branch information
asaf-kali authored Dec 18, 2023
2 parents 07f63d9 + 93fffa3 commit a30b26b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
14 changes: 11 additions & 3 deletions .github/actions/deploy/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -39,15 +42,20 @@ 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
- 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
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
run: |
make test
build-layer:
build-deployment:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
Expand All @@ -34,27 +34,30 @@ 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' }}
runs-on: ubuntu-latest
needs:
- unit-tests
- build-deployment
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Deploy to dev
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
Expand Down Expand Up @@ -94,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
Expand Down

0 comments on commit a30b26b

Please sign in to comment.