Last active
May 24, 2023 13:10
-
-
Save selvesandev/7f113b9102d1461b1a2ae80a20074d1c to your computer and use it in GitHub Desktop.
Deploy your serverless framework aws lambda function from github actions
This file contains hidden or 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: Deploy to Production | |
on: | |
# Runs on pushes targeting the default branch | |
push: | |
branches: ["master"] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
# Build job | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [16.x] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Use Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: Setup Serverless | |
run: npm install -g serverless | |
- name: Install dependencies | |
run: npm ci | |
- name: Generate .env file | |
run: | | |
echo "${{ secrets.PROD_ENV }}" | base64 --decode > .env | |
- 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: eu-west-1 | |
- name: Deploy | |
run: sls deploy -c serverless.yml |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment