-
Notifications
You must be signed in to change notification settings - Fork 16
50 lines (43 loc) · 1.48 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:
push:
branches: [ main ]
jobs:
deploy:
runs-on: ubuntu-latest
env:
DEPLOY_USER: ${{secrets.DEPLOY_USER}}
DEPLOY_HOST: ${{secrets.DEPLOY_HOST}}
DEPLOY_PORT: ${{secrets.DEPLOY_PORT}}
DEPLOY_KEY: ${{secrets.DEPLOY_KEY}}
DEPLOY_TARGET: ${{secrets.DEPLOY_TARGET}}
DEPLOY_OPTIONS: ${{secrets.DEPLOY_OPTIONS}}
steps:
- name: Verify all required secrets are set
run: |
[ -z "$DEPLOY_USER" ] && echo "Missing DEPLOY_USER secret" && exit 1
[ -z "$DEPLOY_HOST" ] && echo "Missing DEPLOY_HOST secret" && exit 1
[ -z "$DEPLOY_PORT" ] && echo "Missing DEPLOY_PORT secret" && exit 1
[ -z "$DEPLOY_KEY" ] && echo "Missing DEPLOY_KEY secret" && exit 1
[ -z "$DEPLOY_TARGET" ] && echo "Missing DEPLOY_TARGET secret" && exit 1
exit 0
- name: Checkout site
uses: actions/checkout@v2
- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1
bundler-cache: true
- name: Setup SSH
run: |
mkdir -p ~/.ssh
echo "Host $DEPLOY_HOST" > ~/.ssh/config
echo " Port $DEPLOY_PORT" >> ~/.ssh/config
echo " StrictHostKeyChecking no" >> ~/.ssh/config
cat ~/.ssh/config
echo "$DEPLOY_KEY" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa ~/.ssh/config
- name: Build site
run: bin/build
- name: Deploy site
run: bin/deploy