-
-
Notifications
You must be signed in to change notification settings - Fork 1
36 lines (30 loc) · 1.12 KB
/
digitalocean_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
name: bulid and deploy
on:
push:
branches:
- deploy/dev
- deploy/production
# This allows a subsequently queued workflow run to interrupt previous runs
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true
jobs:
build-and-deploy:
runs-on: ${{ fromJSON('["ubuntu-latest", "self-hosted"]')[github.repository == 'github/docs-internal'] }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: build and deploy
run: |
echo "${{ secrets.SSH_PRIV_KEY }}" | base64 -d > ssh.key
chmod 600 ssh.key
if [ ${GITHUB_REF#refs/heads/} = "deploy/production" ]; then
repoDir="/home/devops/app/production"
elif [ ${GITHUB_REF#refs/heads/} = "deploy/dev" ]; then
repoDir="/home/devops/app/dev"
else
echo "Invalid environment."
exit 1
fi
ssh -o StrictHostKeyChecking=no -i ssh.key devops@134.209.65.8 \
/home/devops/infra/scripts/deploy.sh "$repoDir" "$GITHUB_SHA"