diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index fb25ab72..00000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: Deploy sls app - -on: - push: - branches: - - feature/deploy - -jobs: - deploy: - runs-on: ubuntu-latest - env: - SERVERLESS_ACCESS_KEY: ${{ secrets.SERVERLESS_ACCESS_KEY }} - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - steps: -<<<<<<< HEAD -<<<<<<< HEAD - - uses: actions/checkout@v3 - - name: Install Python 3.10 - uses: actions/setup-python@v4 - with: - python-version: '3.10' - - name: Install serverless - run: cd aws-sandol-api && npm install -g serverless - - run: serverless plugin install -n serverless-wsgi - - name: Deploy with serverless - run: sls deploy --verbose --force -======= -======= ->>>>>>> parent of a22703c (modify cd directory path) - - uses: actions/checkout@v3 - - name: install-python - uses: actions/setup-python@v4 - with: - python-version: '3.9' - - name: install serverless - run: npm i -g serverless - - run: serverless plugin install -n serverless-wsgi - - name: severless deploy - run: sls deploy --verbose --force -<<<<<<< HEAD ->>>>>>> parent of a22703c (modify cd directory path) -======= ->>>>>>> parent of a22703c (modify cd directory path) - diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 00000000..d43118fb --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,46 @@ +name: Deploy to AWS + +on: + push: + branches: + - feature/deploy + +jobs: + deploy: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.11 + + - name: Install dependencies + run: | + python -m venv .venv + source .venv/bin/activate + pip install -r sandol/requirements.txt + + - name: Install AWS SAM CLI + run: | + pip install aws-sam-cli + + - 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-northeast-2 + + - name: Build with SAM + run: sam build + + - name: Package with SAM + run: sam package --output-template-file packaged.yaml --s3-bucket sandol-sam-deploy-bucket + + - name: Deploy with SAM + run: sam deploy --template-file packaged.yaml --stack-name fastapi-sam-app --capabilities CAPABILITY_IAM --region ap-northeast-2 +