Created
May 26, 2020 09:44
-
-
Save hadynz/b4e190e0ce10e5811cb462920a9c678f to your computer and use it in GitHub Desktop.
Serverless deploy with state management in S3
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: Continuous deploy | |
on: | |
push: | |
branches: [master] | |
jobs: | |
serverless-deploy: | |
runs-on: ubuntu-latest | |
env: | |
AWS_ACCESS_KEY_ID: ${{secrets.AWS_ACCESS_KEY_ID}} | |
AWS_SECRET_ACCESS_KEY: ${{secrets.AWS_SECRET_ACCESS_KEY}} | |
steps: | |
- uses: actions/checkout@v1 | |
- uses: actions/setup-node@v1 | |
with: | |
node-version: 12 | |
- name: Install dependencies | |
run: npm ci | |
- name: Run tests | |
run: npm test | |
- name: Download `.serverless` state from S3 | |
run: aws s3 sync s3://my-bucket/my-repo-name/env-name/.serverless .serverless --delete | |
- name: Deploy to AWS | |
run: npm run deploy | |
- name: Upload `.serverless` state to S3 | |
run: aws s3 sync .serverless s3://my-bucket/my-repo-name/env-name/.serverless --delete |
Hi, do I need to create my bucket before or will it be created via this name "s3://my-bucket/my-repo-name/env-name" ?
Yes, that's right. You will need to ensure that the S3 bucket exists. Either create it manually or look into adding an extra step that does that for you.
thank you 👍
@hadynz Hi, can please clarify what is my-repo-name and env-name here. I tried this but while uploading it exits with error code 255.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, do I need to create my bucket before or will it be created via this name "s3://my-bucket/my-repo-name/env-name" ?