Skip to content

Add mcp-production-deployment (#267) #128

Add mcp-production-deployment (#267)

Add mcp-production-deployment (#267) #128

name: dev deployment
on:
push:
branches: [dev]
workflow_dispatch:
jobs:
unit-tests:
runs-on: ubuntu-20.04
env:
AWS_DEFAULT_REGION: us-west-2
strategy:
matrix:
python: [3.8]
steps:
- uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Install Tox
run: pip install tox
- name: Run Tox test environment
# Run tox using the version of Python in `PATH`
run: tox -e py
dev-deployment:
strategy:
matrix:
python: [3.8]
runs-on: ubuntu-20.04
needs: [unit-tests]
environment:
name: dev
env:
AWS_DEFAULT_REGION: us-west-2
steps:
- uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Install tox
run: pip install tox
- name: Configure awscli
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: us-west-2
- name: Convert to environment variables
env:
SECRETS_CONTEXT: ${{ toJson(secrets) }}
run: |
while read -rd $'' line
do
echo "$line" >> $GITHUB_ENV
done < <(jq -r <<<"$SECRETS_CONTEXT" \
'to_entries|map("\(.key)=\(.value)\u0000")[]')
- name: Deploy with tox
run: tox -e dev -r -- deploy --require-approval never
- name: Run DB setup
env:
HLS_STACKNAME: ${{ secrets.HLS_STACKNAME }}
run: |
setupdb=$(aws cloudformation describe-stacks --stack-name \
$HLS_STACKNAME --query \
"Stacks[0].Outputs[?OutputKey=='setupdbexport'].OutputValue" \
--output=text)
aws lambda invoke --function-name=$setupdb response.json