Skip to content

Commit

Permalink
attempt to fix ansible in action
Browse files Browse the repository at this point in the history
  • Loading branch information
boazsender committed Mar 30, 2024
1 parent 962462b commit 17d7d42
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,17 +115,14 @@ jobs:
runs-on: ubuntu-latest
# needs: [lint, typecheck, vitest, cypress]
if: ${{ (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev') && github.event_name == 'push' }}

steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v4

- name: 🚀 Deploy production
if: ${{ github.ref == 'refs/heads/main' }}
uses: dawidd6/action-ansible-playbook@v2
if: ${{ github.ref == 'refs/heads/main' }}
with:
playbook: deploy.yml
directory: ./deploy
key: ${{secrets.SSH_PRIVATE_KEY}}
# Optional, literal inventory file contents
inventory: ${{ secrets.inventory }}
26 changes: 26 additions & 0 deletions deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
- name: Deploy the app
hosts: all
remote_user: deploy
tasks:
- name: Copy prisma migrations
copy:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
loop: "{{ deploy_files }}"

- name: Install npm deps
shell:
cmd: "source /home/deploy/.nvm/nvm.sh && nvm exec default npm install"
chdir: /home/{{ domain }}
args:
executable: /bin/bash

- name: Run migrations
shell:
cmd: "source /home/deploy/.nvm/nvm.sh && nvm exec default npx prisma migrate deploy"
chdir: /home/{{ domain }}
args:
executable: /bin/bash

- name: Start the app with systemd
shell: "sudo systemctl start {{ domain }}"

0 comments on commit 17d7d42

Please # to comment.