-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (40 loc) Β· 1.28 KB
/
deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: Deploy Site
on:
# Runs on pushes targeting the default branch
push:
branches: ['main']
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build-and-deploy:
name: Build and deploy
environment: Staging
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: npm install
- name: Build app
run: npm run build
- name: Install Ansible
shell: bash
run: |
sudo apt update
sudo apt install -y ansible
- name: Load deploy key
uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: ${{ secrets.SSH_KEY }}
- name: Set server key
run: |
mkdir -p ~/.ssh/ && touch ~/.ssh/known_hosts
echo ${{env.SERVER_PUBLIC_KEYS}} >> ~/.ssh/known_hosts
- name: Run playbook
run: |
cd $GITHUB_WORKSPACE
ansible-playbook -i 'beta.thesociallions.nl', .playbook/playbook.yml -u github-actions --extra-vars "repositoryPath=dist/"