# # Github Actions for Serverless Framework # # Create AWS_KEY and AWS_SECRET secrets in Github repository settings # If you're using env.yml file, store its content as ENV Github secret # # Master branch will be deployed as DEV and every new tag starting with "v**" (e.g. v1.0, v1.2, v2.0, etc) will be deployed as PROD # # Learn more: https://maxkostinevich.com/blog/how-to-deploy-serverless-applications-using-github-actions/ # name: Deploy Prod on: push: tags: # Deploy tag (e.g. v1.0) to production - 'v**' jobs: deploy-prod: runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - uses: actions/setup-node@v1 with: node-version: '10.x' - name: Install Serverless Framework run: npm install -g serverless - name: Serverless AWS authentication run: sls config credentials --provider aws --key ${{ secrets.AWS_KEY }} --secret ${{ secrets.AWS_SECRET }} - name: Create env file run: | # cp sample.env.yml env.yml cat > env.yml << EOF ${{ secrets.ENV }} EOF - name: Install NPM dependencies run: npm install # Optional #- name: Build assets # run: npm run assets-prod - name: Deploy Lambda functions run: sls deploy -s prod # Optional (to use with serverless-finch serverless plugin) #- name: Deploy assets to S3 # run: sls client deploy --no-delete-contents --no-confirm -s prod