Deploy version 3.0.6 on production by @ggrossetie #215
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: Ansible deploy production | |
run-name: Deploy version ${{ inputs.release-version }} on production by @${{ github.actor }} | |
on: | |
# workflow_run: | |
# workflows: | |
# - "Build and deploy Docker images" | |
# types: | |
# - completed | |
workflow_dispatch: | |
inputs: | |
release-version: | |
description: Release version to deploy | |
required: true | |
jobs: | |
deployment: | |
runs-on: ubuntu-latest | |
environment: | |
name: production | |
url: https://stylo.huma-num.fr | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ format('v{0}', inputs.release-version) }} | |
- name: Set up Python 3.10 (w/ cache) | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
cache: 'pip' | |
cache-dependency-path: '**/deploy-requirements.txt' | |
- name: Install dependencies | |
run: | | |
python -m pip install -r .github/workflows/deploy-requirements.txt | |
- name: Set Ansible config secrets | |
run: | | |
echo "${{ secrets.ANSIBLE_VAULT_PASSWORD_PROD }}" > infrastructure/.ansible-vault-password | |
- name: Setup SSH | |
run: | | |
mkdir -p ~/.ssh | |
echo "${{ secrets.SSH_PRIVATE_KEY_PROD }}" > ~/.ssh/id_ed25519 | |
chmod 600 ~/.ssh/id_ed25519 | |
- name: Run playbook | |
working-directory: ./infrastructure | |
run: ansible-playbook -i inventories/prod --extra-vars "@vault-prod.yml" --extra-vars "app_version=${{ inputs.release-version }}" --private-key ~/.ssh/id_ed25519 --vault-password-file ./.ansible-vault-password playbook.yml -v |