Prod Deploy #50
This file contains hidden or 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: Prod Deploy | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: {} | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref_name }} | |
| cancel-in-progress: true | |
| env: | |
| FUNCAKE_BRANCH: ${{ github.ref_name }} | |
| jobs: | |
| prod-deploy: | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: production | |
| timeout-minutes: 30 | |
| strategy: | |
| matrix: | |
| python-version: [ 3.12 ] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Setup Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: "pipenv" | |
| pip-install: pipenv | |
| - name: Install dependencies | |
| run: pipenv install --dev | |
| - name: Checkout ansible-playbook-airflow (private) | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: tulibraries/ansible-playbook-airflow | |
| token: ${{ secrets.MY_PAT }} | |
| path: ansible-playbook-airflow | |
| ref: main | |
| - name: Dump vault password to disk | |
| env: | |
| ANSIBLE_VAULT_PASSWORD: ${{ secrets.ANSIBLE_VAULT_PASSWORD }} | |
| run: | | |
| echo "::add-mask::$ANSIBLE_VAULT_PASSWORD" | |
| printf '%s' "${ANSIBLE_VAULT_PASSWORD}" > "$HOME/.vault" | |
| chmod 600 "$HOME/.vault" | |
| - name: Start ssh-agent and add key | |
| uses: webfactory/ssh-agent@v0.10.0 | |
| with: | |
| ssh-private-key: ${{ secrets.DEPLOY_SSH_KEY }} | |
| - name: Run Ansible Airflow Playbook for Prod | |
| working-directory: ansible-playbook-airflow | |
| run: | | |
| pipenv run ansible-galaxy install -r requirements.yml | |
| pipenv run ansible-playbook -i inventory/prod playbook.yml --tags "jumphost,role::airflow::dags" --vault-password-file "$HOME/.vault" -e 'ansible_ssh_port=9229' -e 'funcake_dags_branch=main' |