-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (79 loc) · 2.26 KB
/
build-and-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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: Build (and deploy)
on:
push:
branches:
master
# run a minute past midnight (UTC), every day
schedule:
- cron: '01 00 * * *'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-20.04
if: github.event_name == 'push'
steps:
- name: Checkout
uses: actions/checkout@v2
with:
persist-credentials: false
- name: Setup go
uses: actions/setup-go@v2
with:
go-version: '^1.15'
- name: Build
run: |
make fruktsam
./fruktsam
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
deploy:
runs-on: ubuntu-20.04
if: (github.event_name == 'schedule') || (github.event_name == 'workflow_dispatch')
steps:
- name: Checkout
uses: actions/checkout@v2
with:
persist-credentials: true
- name: Setup go
uses: actions/setup-go@v2
with:
go-version: '^1.15'
- name: Install ssh
shell: bash
run: |
sudo apt-get update
sudo apt-get --no-install-recommends --no-install-suggests install openssh-client
- name: Fetch image cache
shell: bash
run: |
mkdir -p ./dist/images
cd ./dist/images
umask 077; echo "$PK" >/tmp/pk
echo "-get *.jpg" | sftp -b - -i /tmp/pk -o StrictHostKeyChecking=no sftp://[email protected]:55666/fruktsam/images/
rm -f /tmp/pk
env:
PK: ${{ secrets.FRUKT_PRIVATEKEY }}
- name: Build
run: |
make fruktsam
./fruktsam
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
- name: Commit reversecache
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "Update reversecache (fruktrobot)"
branch: master
file_pattern: reversecache
commit_user_name: 'fruktrobot'
commit_user_email: '<>'
- name: Deploy
shell: bash
run: |
cd ./dist
chmod -R go+rX .
umask 077; echo "$PK" >/tmp/pk
echo "put -Rp ." | sftp -b - -i /tmp/pk -o StrictHostKeyChecking=no sftp://[email protected]:55666/fruktsam/
rm -f /tmp/pk
env:
PK: ${{ secrets.FRUKT_PRIVATEKEY }}