attempt 4 #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: BnbBankCI | |
on: | |
pull_request: | |
branches: | |
- staging | |
- production | |
jobs: | |
deploy-api: | |
name: deploy-api | |
runs-on: ubuntu-latest | |
steps: | |
# This step checks out a copy of your repository. | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
# Place directory on backend project codebase | |
- name: Select backend directory | |
run: cd ../../backend | |
# This step sets up Node.js environment. | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
if: success() | |
# This step installs the Serverless Framework globally. | |
- name: Install Serverless Framework | |
run: npm install -g serverless serverless-prune-plugin serverless-iam-roles-per-function | |
if: success() | |
# This step sets up PHP environment with the specified version. | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: "8.2" | |
if: success() | |
# This step installs Composer dependencies with the specified options. | |
- name: Install Composer dependencies | |
uses: "ramsey/composer-install@v2" | |
with: | |
composer-options: "--prefer-dist --optimize-autoloader --no-dev" | |
if: success() | |
# This step deploys your application to AWS Lambda using the Serverless Framework. | |
- name: Deploy to AWS Lambda | |
uses: serverless/github-action@v3 | |
with: | |
args: deploy --stage ${GITHUB_REF#refs/heads/} --region ${{ secrets.AWS_DEFAULT_REGION }} --verbose | |
env: | |
DOMAIN: ${{ vars.DOMAIN }} | |
DB_URI: ${{ secrets.DB_URI }} | |
JWT_SECRET: ${{ secrets.JWT_SECRET }} | |
AWS_HOSTED_ZONE_ID: ${{ vars.AWS_HOSTED_ZONE_ID }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
if: success() |