-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.build.yml
50 lines (50 loc) · 1.62 KB
/
.build.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
image: debian/bookworm
packages:
- git
- sassc
- wget
secrets:
- dfbc7cb0-b02f-44ab-9b11-cf1a5467c3d2
sources:
- ssh://git@git.sr.ht/~aqtrans/gowiki
environment:
project: gowiki
remote: deploy@bob.squanch.space
goversion: 1.23.4
triggers:
- action: email
condition: failure
to: Jordan Anderson <jordan@jba.io>
tasks:
- setupgo: |
wget -q https://go.dev/dl/go${goversion}.linux-amd64.tar.gz
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf go${goversion}.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin
- setup: |
cd ${project}
export PATH=$PATH:/usr/local/go/bin
go get -d
go generate
- test: |
cd ${project}
export PATH=$PATH:/usr/local/go/bin
go test
go test -cover
go test -bench=.
- scss: |
cd ${project}
sassc -t compressed scss/grid.scss assets/css/wiki.css
- build: |
cd ${project}
export PATH=$PATH:/usr/local/go/bin
go build -ldflags "-X main.sha1ver=$(git rev-parse HEAD) -X main.buildTime=$(date +'%Y-%m-%d_%T')" -o gowiki
if [ "$(git rev-parse origin/master)" != "$(git rev-parse HEAD)" ]; then \
complete-build; \
fi
- deploy: |
cd ${project}
scp -i ~/.ssh/id_rsa -o StrictHostKeyChecking=no gowiki $remote:/opt/deploy/gowiki
ssh -i ~/.ssh/id_rsa -o StrictHostKeyChecking=no $remote "sudo /usr/bin/systemctl stop gowiki"
ssh -i ~/.ssh/id_rsa -o StrictHostKeyChecking=no $remote "sudo /usr/bin/mv /opt/deploy/gowiki /usr/local/bin/gowiki"
ssh -i ~/.ssh/id_rsa -o StrictHostKeyChecking=no $remote "sudo /usr/bin/systemctl start gowiki"