Run deploys in runner #280
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 to k8s cluster | |
on: | |
push: | |
branches: | |
- main | |
- develop | |
jobs: | |
deploy: | |
runs-on: | |
- self-hosted | |
- philly-hip | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }} | |
# https://github.com/marketplace/actions/slack-github-actions-slack-integration | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
cache: 'pip' | |
cache-dependency-path: 'requirements/*/**.txt' | |
- name: Install dependencies | |
id: pip-install | |
run: | | |
python -m pip install --upgrade pip wheel pip-tools | |
pip-sync requirements/base/base.txt requirements/dev/dev.txt | |
- name: Login to Docker | |
id: docker-login | |
run: | | |
inv aws.docker-login | |
- name: Build, tag, push, and deploy image | |
id: build-tag-push-deploy | |
run: | | |
[ "$GITHUB_REF" = refs/heads/main ] && | |
ENV="production" || | |
ENV="staging" | |
echo "env is $ENV" | |
inv $ENV image deploy --verbosity=0 | |
- uses: act10ns/slack@v1 | |
with: | |
status: ${{ job.status }} | |
steps: ${{ toJson(steps) }} | |
# always() means to notify regardless of status | |
if: always() |