Skip to content

Revert "Revert "small front updates to test deploy action"" #3

Revert "Revert "small front updates to test deploy action""

Revert "Revert "small front updates to test deploy action"" #3

Workflow file for this run

name: Deploy Front with Ansible
on:
pull_request:
paths:
- 'front/**'
branches:
- main
types: [closed]
jobs:
deploy:
name: Deploy Ansible Playbook
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./front
environment: production
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up SSH
run: |
echo "${{ secrets.SSH_PRIVATE_KEY }}" > private_key.pem
chmod 600 private_key.pem
- name: Create and populate inventory file
working-directory: ./deploy
env:
ANSIBLE_INVENTORY: ${{ secrets.ANSIBLE_INVENTORY }}
run: |
touch inventory.ini
echo $ANSIBLE_INVENTORY >> inventory.ini
- name: Create and populate vault.yml vars file
working-directory: ./deploy
env:
ANSIBLE_VAULT: ${{ secrets.ANSIBLE_VAULT }}
run: |
touch vars/vault.yml
echo $ANSIBLE_VAULT >> vars/vault.yml
- name: Setup
uses: actions/setup-node@v4
with:
node-version: '20.x'
- run: npm install
- run: npm run build:prod
- name: Install Ansible
shell: bash
run: |
sudo apt update
sudo apt install -y ansible
- name: Run Ansible Playbook
working-directory: ./deploy
env:
BECOME_PASSWORD_FILE: ${{ secrets.ANSIBLE_BECOME_PASSWORD }}
ANSIBLE_HOST_KEY_CHECKING: False
run: |
ansible-playbook front.yml -i inventory.ini --private-key private_key.pem