Skip to content

Dev code deploy

Dev code deploy #1389

Workflow file for this run

name: Dev code deploy
on:
workflow_dispatch:
schedule:
- cron: "0 6 * * *"
jobs:
deploy:
env:
perm_env: dev
strategy:
matrix:
machine: [backend, cron, taskrunner, sftp]
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v1
- name: Configure AWS Credentials
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: ${{ secrets.AWS_DEFAULT_REGION }}
- name: Save ssh deploy key to a file
run: |
echo "$SSH_KEY" > key
chmod 400 key
env:
SSH_KEY: ${{ secrets.DEPLOYER_PRIVATE_KEY }}
- name: Install ansible dependencies
run: ansible-galaxy collection install 'community.general:<3.3.0'
- name: Generate Inventory
run: ./scripts/generate_inventory.sh ${{ env.perm_env }} ${{ matrix.machine }}
- name: Send start Slack notification
run: curl -X POST -H 'Content-type:application/json' --data '{"text":"${{ env.perm_env }} ${{ matrix.machine }} deploy started"}' https://hooks.slack.com/services/TBBFM3TEY/BJKUMT4CC/${{ secrets.SLACK_KEY }}
- name: Run deploy
run: ansible-playbook provisioners/deploy-${{ matrix.machine }}.yml -vv -e "perm_env=${{ env.perm_env }} database_url=${{ secrets.DEV_DATABASE_URL }} run_migrations=true" -i inventory.ini
env:
ANSIBLE_PIPELINING: True
ANSIBLE_HOST_KEY_CHECKING: False
- name: Send end Slack notification
run: curl -X POST -H 'Content-type:application/json' --data '{"text":"${{ env.perm_env }} ${{ matrix.machine }} deploy complete"}' https://hooks.slack.com/services/TBBFM3TEY/BJKUMT4CC/${{ secrets.SLACK_KEY }}
test_deploy:
runs-on: ubuntu-latest
needs: deploy
steps:
- name: Trigger the functional test
run: curl -X POST -H 'Accept:application/vnd.github.v3+json' -H 'Authorization:Bearer ${{ secrets.CKRUM_PAT }}' https://api.github.com/repos/PermanentOrg/functional-test/dispatches -d '{"event_type":"dev_deployed"}'