-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (58 loc) · 1.98 KB
/
update_dogsheep_dbs.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
51
52
53
54
55
56
57
58
name: Update Dogsheep DBs
run-name: Update Dogsheep DBs
on: workflow_dispatch
env:
BUCKET_TF_STATE: ${{ secrets.BUCKET_TF_STATE}}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
jobs:
sqlite:
name: Update sqlite files
runs-on: ubuntu-latest
steps:
- run: echo "Job is running on ${{ runner.os }}"
- run: echo "Branch name is ${{ github.ref }} and repository is ${{ github.repository }}."
- name: Tailscale
uses: tailscale/github-action@v1
with:
authkey: ${{ secrets.TAILSCALE_EPHEMERAL_KEY }}
- name: Check out repository code
uses: actions/checkout@v3
- name: Configure SSH
run: |
mkdir -p ~/.ssh/
echo "$SSH_KEY" > ~/.ssh/server.key
chmod 600 ~/.ssh/server.key
cat >>~/.ssh/config <<END
Host server
HostName $SSH_HOST
User $SSH_USER
IdentityFile ~/.ssh/server.key
StrictHostKeyChecking no
END
env:
SSH_USER: ${{ secrets.SSH_USER }}
SSH_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
SSH_HOST: ${{ secrets.SSH_HOST }}
- name: Configure AWS
run: |
ssh server 'aws configure set aws_access_key_id ${{ secrets.AWS_ACCESS_KEY_ID }};
aws configure set aws_secret_access_key ${{ secrets.AWS_SECRET_ACCESS_KEY }};
aws configure set default.region ${{ secrets.AWS_DEFAULT_REGION }};'
- name: Copy files from s3
run: |
ssh server <<EOF
aws s3 sync s3://dogsheep-db ~/mnt/dogsheep/dbs/
EOF
- name: Restart dogsheep
run: |
ssh server <<EOF
cd ~/docker
docker-compose stop dogsheep
sleep 30s
docker-compose up -d dogsheep
EOF
- name: Sleep for 1 minutes while container becomes healthy
run: sleep 1m
shell: bash
- run: echo "Job is ${{ job.status }}."