Skip to content

Give changelogTimeline a default empty value #66

Give changelogTimeline a default empty value

Give changelogTimeline a default empty value #66

name: Serverless Deployment
env:
SLACK_CHANNEL: tangential-ci-updates
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
MONGODB_URI: ${{ secrets.MONGODB_URI }}
on:
push:
branches:
- main
- develop
jobs:
deploy:
runs-on: ubuntu-latest
defaults:
run:
working-directory: tangential
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '19'
- name: Install dependencies
run: yarn install
env:
PACKAGE_TOKEN: ${{ secrets.PACKAGE_TOKEN }}
- name: Run unit tests
run: yarn unit-test
id: unit-tests
env:
PACKAGE_TOKEN: ${{ secrets.PACKAGE_TOKEN }}
- name: Run integration tests
run: yarn int-test
id: int-tests
env:
PACKAGE_TOKEN: ${{ secrets.PACKAGE_TOKEN }}
- name: Deploy to dev
if: github.ref == 'refs/heads/develop'
run: ./node_modules/serverless/bin/serverless.js deploy --stage dev
id: deploy-dev
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Deploy to prod
if: github.ref == 'refs/heads/main'
run: ./node_modules/serverless/bin/serverless.js deploy --stage prod
id: deploy-prod
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Slack Notification for Test Failures
if: ${{ failure() && steps.unit-tests.outcome == 'failure' }}
uses: rtCamp/action-slack-notify@v2
env:
SLACK_COLOR: danger
SLACK_MESSAGE: 'Tangential Backend: Unit tests failed :bomb: | ${{ github.event.head_commit.message }}'
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
- name: Slack Notification for Dev Deployment Failure
if: ${{ failure() && steps.deploy-dev.outcome == 'failure' }}
uses: rtCamp/action-slack-notify@v2
env:
SLACK_COLOR: danger
SLACK_MESSAGE: 'Tangential Backend: Deployment to dev failed :fire: | ${{ github.event.head_commit.message }}'
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
- name: Slack Notification for prod Deployment Failure
if: ${{ failure() && steps.deploy-prod.outcome == 'failure' }}
uses: rtCamp/action-slack-notify@v2
env:
SLACK_COLOR: danger
SLACK_MESSAGE: 'Tangential Backend: Deployment to prod failed :fire: | ${{ github.event.head_commit.message }}'
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
- name: Slack Success Notification
if: ${{ success() }}
uses: rtCamp/action-slack-notify@v2
env:
SLACK_COLOR: good
SLACK_MESSAGE: 'Tangential Backend: Deployment successful :tada: | ${{ github.event.head_commit.message }}'
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
- name: Slack Notification for Integration Test Failures
if: ${{ failure() && steps.int-tests.outcome == 'failure' }}
uses: rtCamp/action-slack-notify@v2
env:
SLACK_CHANNEL: ${{ env.SLACK_CHANNEL }}
SLACK_COLOR: danger
SLACK_MESSAGE: 'Tangential Backend: Integration tests failed :boom: | ${{ github.event.head_commit.message }}'
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}