Skip to content

Merge pull request #35 from nalbam/main #55

Merge pull request #35 from nalbam/main

Merge pull request #35 from nalbam/main #55

Workflow file for this run

name: Deploy to AWS Lambda
on:
push:
branches:
- main
repository_dispatch:
types:
- deploy
env:
AWS_REGION: "us-east-1"
AWS_ROLE_NAME: "lambda-gurumi-ai-bot"
AGENT_ALIAS_ID: ${{ vars.AGENT_ALIAS_ID }}
AGENT_ID: ${{ vars.AGENT_ID }}
ALLOWED_CHANNEL_IDS: ${{ vars.ALLOWED_CHANNEL_IDS }}
BOT_CURSOR: ${{ vars.BOT_CURSOR }}
DYNAMODB_TABLE_NAME: ${{ vars.DYNAMODB_TABLE_NAME }}
MAX_LEN_SLACK: ${{ vars.MAX_LEN_SLACK }}
MAX_THROTTLE_COUNT: ${{ vars.MAX_THROTTLE_COUNT }}
PERSONAL_MESSAGE: ${{ vars.PERSONAL_MESSAGE }}
SLACK_SAY_INTERVAL: ${{ vars.SLACK_SAY_INTERVAL }}
SYSTEM_MESSAGE: ${{ vars.SYSTEM_MESSAGE }}
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
SLACK_SIGNING_SECRET: ${{ secrets.SLACK_SIGNING_SECRET }}
# Permission can be added at job level or workflow level
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
jobs:
deploy:
runs-on: ubuntu-24.04
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python 3.9 🐍
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Install dependencies
run: npm install
- name: Install Python dependencies
run: npx serverless plugin install --name serverless-python-requirements
- name: Install dotenv plugin
run: npx serverless plugin install --name serverless-dotenv-plugin
- name: Install dependencies
run: pip install -r requirements.txt
- name: Set up environment variables 📝
run: |
echo "AGENT_ALIAS_ID=${AGENT_ALIAS_ID}" >> .env
echo "AGENT_ID=${AGENT_ID}" >> .env
echo "ALLOWED_CHANNEL_IDS=${ALLOWED_CHANNEL_IDS}" >> .env
echo "BOT_CURSOR=${BOT_CURSOR}" >> .env
echo "DYNAMODB_TABLE_NAME=${DYNAMODB_TABLE_NAME}" >> .env
echo "MAX_LEN_SLACK=${MAX_LEN_SLACK}" >> .env
echo "MAX_THROTTLE_COUNT=${MAX_THROTTLE_COUNT}" >> .env
echo "PERSONAL_MESSAGE=${PERSONAL_MESSAGE}" >> .env
echo "SLACK_BOT_TOKEN=${SLACK_BOT_TOKEN}" >> .env
echo "SLACK_SAY_INTERVAL=${SLACK_SAY_INTERVAL}" >> .env
echo "SLACK_SIGNING_SECRET=${SLACK_SIGNING_SECRET}" >> .env
echo "SYSTEM_MESSAGE=${SYSTEM_MESSAGE}" >> .env
- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: "arn:aws:iam::${{ env.AWS_ACCOUNT_ID }}:role/${{ env.AWS_ROLE_NAME }}"
role-session-name: github-actions-ci-bot
aws-region: ${{ env.AWS_REGION }}
- name: Deploy to AWS Lambda 🚀
run: npx serverless deploy --region ${{ env.AWS_REGION }}