Commit 35be687 1 parent 8897ae3 commit 35be687 Copy full SHA for 35be687
File tree 2 files changed +84
-0
lines changed
2 files changed +84
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ exec > >( tee -a /home/user/apps/webhook/deploy-napoli/output.log) 2>&1
4
+
5
+ an_napoli_server=napoli-server-linux-x64
6
+ an_napoli_pain=napoli-pain-wasm.tar.gz
7
+
8
+ # Change to a clean working dir
9
+ owd=$( echo $PWD )
10
+ date_stamp=$( date +" %F-%H-%M-%S" )
11
+ wd=$owd /deploy-$date_stamp
12
+ mkdir -p $wd && cd $wd
13
+
14
+ # Download release artifacts from github
15
+ url=$( curl -s https://api.github.com/repos/muccc-rs/napoli-rust/releases/latest | jq -r " .assets[] | select(.name | test(\" $an_napoli_pain \" )) | .browser_download_url" ) ; wget -q " $url "
16
+
17
+ # Redeploy napoli-pain
18
+ np_webroot=/var/www/virtual/user/pizza.website.com/
19
+ tar -xzf $an_napoli_pain
20
+ rsync -vaxSHAX --delete dist/ $np_webroot
21
+
22
+ # Redeploy napoli-server
23
+ ns_bin=/home/user/apps/napoli-server/napoli-server
24
+
25
+ # url=$(curl -s https://api.github.com/repos/git-commit/napoli-rust/releases/latest | jq -r ".assets[] | select(.name | test(\"$an_napoli_server\")) | .browser_download_url"); wget -q "$url"
26
+ # mv $an_napoli_server $ns_bin
27
+
28
+ cd /home/user/dev/napoli-rust
29
+ git reset --hard HEAD
30
+ git pull
31
+
32
+ if cargo build --release --bin napoli-server
33
+ then
34
+ echo " First build successful"
35
+ else
36
+ cargo clean
37
+ if cargo build --release --bin napoli-server
38
+ then
39
+ echo " Second build successful"
40
+ else
41
+ echo " Second build NOT successful"
42
+ exit 1
43
+ fi
44
+ fi
45
+
46
+
47
+ supervisorctl stop napoli-server
48
+ cp /home/user/dev/napoli-rust/target/release/napoli-server $ns_bin
49
+ chmod +x $ns_bin
50
+ supervisorctl start napoli-server
51
+
52
+ # Cleanup
53
+ rm -rf $wd
Original file line number Diff line number Diff line change
1
+ [
2
+ {
3
+ "id" : " deploy-napoli" ,
4
+ "execute-command" : " /home/user/apps/webhook/deploy-napoli/deploy-napoli.sh" ,
5
+ "command-working-directory" : " /home/user/dev/napoli-rust" ,
6
+ "trigger-rule" : {
7
+ "and" : [
8
+ {
9
+ "match" : {
10
+ "type" : " payload-hmac-sha1" ,
11
+ "secret" : " " ,
12
+ "parameter" : {
13
+ "source" : " header" ,
14
+ "name" : " X-Hub-Signature"
15
+ }
16
+ }
17
+ },
18
+ {
19
+ "match" : {
20
+ "type" : " regex" ,
21
+ "value" : " refs/tags/build_*" ,
22
+ "parameter" : {
23
+ "source" : " payload" ,
24
+ "name" : " ref"
25
+ }
26
+ }
27
+ }
28
+ ]
29
+ }
30
+ }
31
+ ]
You can’t perform that action at this time.
0 commit comments