Deploy to production by @wsanchez #26
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
# Docs: https://docs.github.com/en/actions | |
name: Deploy to production | |
run-name: Deploy to production by @${{ github.actor }} | |
on: workflow_dispatch | |
jobs: | |
push-to-production: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Harden CI | |
uses: step-security/[email protected] | |
with: | |
disable-sudo: true | |
egress-policy: block | |
allowed-endpoints: > | |
ecs.us-west-2.amazonaws.com:443 | |
files.pythonhosted.org:443 | |
github.com:443 | |
pypi.org:443 | |
raw.githubusercontent.com:443 | |
sts.us-west-2.amazonaws.com:443 | |
api.github.com:443 | |
objects.githubusercontent.com:443 | |
- name: Check user | |
if: ${{ ! contains('["wsanchez", "mikeburg", "plapsley"]', github.actor) }} | |
run: false | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ secrets.AWS_DEFAULT_REGION }} | |
- name: Checkout source code | |
uses: actions/checkout@v4 | |
- name: Install Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- name: System Python Information | |
uses: twisted/python-info-action@v1 | |
- name: Deploy to production | |
run: ./bin/deploy production | |
env: | |
# https://github.com/burningmantech/ranger-ims-server/settings/secrets | |
AWS_ECR_IMAGE_NAME: ${{ secrets.AWS_ECR_IMAGE_NAME }} | |
AWS_ECS_CLUSTER_STAGING: rangers | |
AWS_ECS_SERVICE_STAGING: ${{ secrets.AWS_ECS_SERVICE_STAGING }} | |
AWS_ECS_CLUSTER_PRODUCTION: rangers | |
AWS_ECS_SERVICE_PRODUCTION: ${{ secrets.AWS_ECS_SERVICE_PRODUCTION }} | |
NOTIFY_SMTP_HOST: ${{ secrets.NOTIFY_SMTP_HOST }} | |
NOTIFY_SMTP_USER: ${{ secrets.NOTIFY_SMTP_USER }} | |
NOTIFY_SMTP_PASSWORD: ${{ secrets.NOTIFY_SMTP_PASSWORD }} | |
NOTIFY_EMAIL_RECIPIENT: ${{ secrets.NOTIFY_EMAIL_RECIPIENT }} | |
NOTIFY_EMAIL_SENDER: ${{ secrets.NOTIFY_EMAIL_SENDER }} | |
CI: true | |
PROJECT_NAME: Ranger IMS Server | |
REPOSITORY_ID: ${{ github.repository }} | |
BUILD_NUMBER: 0 | |
BUILD_URL: https://github.com/burningmantech/ranger-ims-server/commit/${{ github.sha }}/checks | |
COMMIT_ID: ${{ github.sha }} | |
COMMIT_AUTHOR_USER: ${{ github.actor }} | |
push-to-training: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Harden CI | |
uses: step-security/[email protected] | |
with: | |
disable-sudo: true | |
egress-policy: block | |
allowed-endpoints: > | |
ecs.us-west-2.amazonaws.com:443 | |
files.pythonhosted.org:443 | |
github.com:443 | |
pypi.org:443 | |
raw.githubusercontent.com:443 | |
sts.us-west-2.amazonaws.com:443 | |
- name: Check user | |
if: ${{ ! contains('["wsanchez", "mikeburg", "plapsley"]', github.actor) }} | |
run: false | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ secrets.AWS_DEFAULT_REGION }} | |
- name: Checkout source code | |
uses: actions/checkout@v4 | |
- name: Install Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- name: System Python Information | |
uses: twisted/python-info-action@v1 | |
- name: Deploy to training | |
run: ./bin/deploy production | |
env: | |
# https://github.com/burningmantech/ranger-ims-server/settings/secrets | |
AWS_ECR_IMAGE_NAME: ${{ secrets.AWS_ECR_IMAGE_NAME }} | |
AWS_ECS_CLUSTER_STAGING: rangers | |
AWS_ECS_SERVICE_STAGING: ${{ secrets.AWS_ECS_SERVICE_STAGING }} | |
AWS_ECS_CLUSTER_PRODUCTION: rangers | |
AWS_ECS_SERVICE_PRODUCTION: ${{ secrets.AWS_ECS_SERVICE_TRAINING }} | |
NOTIFY_SMTP_HOST: ${{ secrets.NOTIFY_SMTP_HOST }} | |
NOTIFY_SMTP_USER: ${{ secrets.NOTIFY_SMTP_USER }} | |
NOTIFY_SMTP_PASSWORD: ${{ secrets.NOTIFY_SMTP_PASSWORD }} | |
NOTIFY_EMAIL_RECIPIENT: ${{ secrets.NOTIFY_EMAIL_RECIPIENT }} | |
NOTIFY_EMAIL_SENDER: ${{ secrets.NOTIFY_EMAIL_SENDER }} | |
CI: true | |
PROJECT_NAME: Ranger IMS Server | |
REPOSITORY_ID: ${{ github.repository }} | |
BUILD_NUMBER: 0 | |
BUILD_URL: https://github.com/burningmantech/ranger-ims-server/commit/${{ github.sha }}/checks | |
COMMIT_ID: ${{ github.sha }} | |
COMMIT_AUTHOR_USER: ${{ github.actor }} |