open Python position #140
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: Deploy | |
on: | |
push: | |
branches: [master] | |
workflow_dispatch: | |
jobs: | |
notify-build-start: | |
if: ${{ github.event_name == 'push' }} | |
runs-on: ubuntu-latest | |
steps: | |
# Send build notifications to Slack | |
- uses: ivelum/github-action-slack-notify-build@v1.6.0 | |
id: slack | |
with: | |
channel_id: G054C3DPL | |
status: STARTED | |
color: '#ee9b00' | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | |
outputs: | |
status_message_id: ${{ steps.slack.outputs.message_id }} | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: '16' | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- uses: ./.github/actions/install-js-dependencies | |
- uses: ./.github/actions/install-python-dependencies | |
- run: yarn eslint | |
- run: yarn stylelint | |
- run: isort . | |
- run: flake8 . | |
# Send notification on check failure | |
- name: Notify slack fail | |
uses: ivelum/github-action-slack-notify-build@v1.6.0 | |
if: failure() | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | |
with: | |
channel_id: G054C3DPL | |
status: FAILED | |
color: '#d7263d' | |
deploy-app: | |
needs: lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: '16' | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- uses: ./.github/actions/install-js-dependencies | |
- uses: ./.github/actions/install-python-dependencies | |
- run: yarn build | |
- env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
run: python run.py deploy-app | |
# Send notification on build or deploy failure | |
- name: Notify slack fail | |
uses: ivelum/github-action-slack-notify-build@v1.6.0 | |
if: failure() | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | |
with: | |
channel_id: G054C3DPL | |
status: FAILED | |
color: '#d7263d' | |
deploy-lambda: | |
needs: lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- uses: ./.github/actions/install-python-dependencies | |
- run: pip install --target lambda-package/dependencies -r lambda-package/requirements.txt | |
- env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
GOOGLE_API_SERVICE_ACCOUNT_INFO: ${{ secrets.GOOGLE_API_SERVICE_ACCOUNT_INFO }} | |
GOOGLE_SPREADSHEET_ID: ${{ secrets.GOOGLE_SPREADSHEET_ID }} | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | |
PIPEDRIVE_TOKEN: ${{ secrets.PIPEDRIVE_TOKEN }} | |
run: python run.py deploy-lambda | |
# Send notification on build or deploy failure | |
- name: Notify slack fail | |
uses: ivelum/github-action-slack-notify-build@v1.6.0 | |
if: failure() | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | |
with: | |
channel_id: G054C3DPL | |
status: FAILED | |
color: '#d7263d' | |
notify-build-success: | |
if: ${{ github.event_name == 'push' }} | |
needs: [deploy-app, deploy-lambda, notify-build-start] | |
runs-on: ubuntu-latest | |
steps: | |
# Send notification on build success | |
- name: Notify slack success | |
uses: ivelum/github-action-slack-notify-build@v1.6.0 | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | |
with: | |
message_id: ${{ needs.notify-build-start.outputs.status_message_id }} | |
channel_id: G054C3DPL | |
status: SUCCESS | |
color: '#16db65' |