Skip to content

update readme (again) #14

update readme (again)

update readme (again) #14

Workflow file for this run

name: Deploy to AWS Elastic Beanstalk
permissions:
id-token: write
contents: read
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Docker
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-southeast-1
role-duration-seconds: 1200
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Fix Configuration
run: |
mv config/config.example.env config/config.env
envsubst < config/config.example.yml > config/config.yml
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
TELEGRAM_API_KEY: ${{ secrets.TELEGRAM_API_KEY }}
ALLOWED_USERS: ${{ vars.ALLOWED_USERS }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ steps.login-ecr.outputs.registry }}/chatgpt_telegram_bot:latest
- name: Install AWS Elastic Beanstalk CLI
run: |
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install --update
- name: Deploy to AWS Elastic Beanstalk
run: |
echo Deploying to AWS Elastic Beanstalk...
aws configure set aws_access_key_id ${{ secrets.AWS_ACCESS_KEY_ID }}
aws configure set aws_secret_access_key ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws configure set default.region ${{ vars.AWS_REGION }}
zip -r source.zip .
aws s3 cp source.zip s3://palo-it-chatgpt-telegram-bot/source.zip
aws elasticbeanstalk create-application-version --application-name palo-it-chatgpt-telegram-bot --version-label ${{ github.sha }} --source-bundle S3Bucket="palo-it-chatgpt-telegram-bot",S3Key="source.zip"
aws elasticbeanstalk update-environment --application-name palo-it-chatgpt-telegram-bot --environment-name prod --version-label ${{ github.sha }}
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ vars.AWS_REGION }}