From 1dd9e2ed039ffbf0bb23701ee388db8590118043 Mon Sep 17 00:00:00 2001 From: Ronaldo Macapobre Date: Fri, 1 Nov 2024 08:09:51 -0700 Subject: [PATCH] Initial GHA for deploying Lambda functions to ECR (#60) Co-authored-by: Ronaldo Macapobre --- .github/workflows/publish-lambdas.yml | 51 +++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/publish-lambdas.yml diff --git a/.github/workflows/publish-lambdas.yml b/.github/workflows/publish-lambdas.yml new file mode 100644 index 00000000..7a5de6bf --- /dev/null +++ b/.github/workflows/publish-lambdas.yml @@ -0,0 +1,51 @@ +name: Deploy Lambda Functions + +on: + push: + branches: + - master + paths: + - "aws/**" + + workflow_dispatch: + +env: + WORKING_DIRECTORY: ./aws + NODE_VERSION: 20 + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ env.NODE_VERSION }} + + - name: Install dependencies + run: npm install + working-directory: ${{ env.WORKING_DIRECTORY }} + + - name: Run build + run: npm run build + working-directory: ${{ env.WORKING_DIRECTORY }} + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + role-skip-session-tagging: true + aws-region: ${{ vars.AWS_REGION }} + role-to-assume: ${{ vars.AWS_ROLE_ARN }} + role-duration-seconds: 1800 + role-session-name: ci-deployment + + - name: Log in to the GHCR + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file