-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (41 loc) · 1.58 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
name: Deploy to Uberspace
on:
push:
branches:
- staging
- development
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Set environment variables for development
if: ${{ github.ref_name == 'development' }}
run: |
echo "REMOTE_HOST=${{ secrets.REMOTE_HOST_DEV }}" >> $GITHUB_ENV
echo "REMOTE_USER=${{ secrets.REMOTE_USER_DEV }}" >> $GITHUB_ENV
echo "DOMAIN=https://editor.serlo.dev/" >> $GITHUB_ENV
- name: Set environment variables for staging
if: ${{ github.ref_name == 'staging' }}
run: |
echo "REMOTE_HOST=${{ secrets.REMOTE_HOST_STAGING }}" >> $GITHUB_ENV
echo "REMOTE_USER=${{ secrets.REMOTE_USER_STAGING }}" >> $GITHUB_ENV
echo "DOMAIN=https://editor.serlo-staging.dev/" >> $GITHUB_ENV
- name: Deploy to Server
uses: appleboy/[email protected]
with:
host: ${{ env.REMOTE_HOST }}
username: ${{ env.REMOTE_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
cd /home/${{ env.REMOTE_USER }}/serlo-editor-as-lti-tool/
git checkout --force ${{ github.ref_name }}
git pull
yarn
yarn build
s3cmd get s3://edtr-env/${{ env.REMOTE_USER }}/.env . --force
supervisorctl restart serlo-app
- name: Test deployment successful
run:
for ((i=0; i<30; i++)); do curl ${{ env.DOMAIN }} | grep -q
"NO_LTIK_OR_IDTOKEN_FOUND" && exit 0; sleep 1; done; echo "Server not
ready within 30 seconds." && exit 1