generated from WildCodeSchool/create-js-monorepo
-
Notifications
You must be signed in to change notification settings - Fork 3
41 lines (38 loc) · 1.24 KB
/
deploy-traefik.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
name: CD-traefik
on:
push:
branches:
- main
pull_request:
branches:
- main
types: [closed]
jobs:
check-secrets:
if: (github.event.pull_request.merged || github.event_name == 'push')
runs-on: ubuntu-latest
outputs:
caprover-server: ${{ steps.caprover-server.outputs.defined }}
steps:
- name: Check for secrets availability
id: defined
# perform secret check & put boolean result as an output
shell: bash
run: |
if [ "${{ secrets.SSH_USER }}" != '' && "${{ secrets.SSH_HOST }}" != '' && "${{ secrets.SSH_PASSWORD }}" != '' ]; then
echo "defined=true" >> $GITHUB_OUTPUT;
else
echo "defined=false" >> $GITHUB_OUTPUT;
fi
deploy:
needs: check-secrets
if: needs.check-secrets.outputs.defined == 'true'
runs-on: ubuntu-latest
steps:
- name: Deploy to VPS
uses: appleboy/ssh-action@master
with:
username: ${{ secrets.SSH_USER }}
host: ${{ secrets.SSH_HOST }}
password: ${{ secrets.SSH_PASSWORD }}
script: cd && cd traefik/deploy && bash ./js-project.sh ${{ github.actor }} ${{ github.event.repository.name }} ${{ vars.PROJECT_NAME }} '${{ toJSON(vars) }}'