-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.build.yml
80 lines (80 loc) · 2.71 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
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
image: alpine/3.18
packages:
- meson
- gcc
- git
- alpine-sdk
- libc-dev
- sqlite-dev
- libconfig-dev
- curl-dev
- libmicrohttpd-dev
- openssl-dev
- libucontext-dev
- sqlite
- docker
sources:
- https://github.com/brenns10/cbot
secrets:
- 26940529-4ef2-42b9-af4d-6225d87dd525 # github token (export GITHUB_TOKEN=...)
- 7b922363-3ca0-4080-863f-5404a4e6796f # package key
- 29e80069-2df8-4bd1-9801-313f2ac4a82b # docker hub
tasks:
- ghsetup: |
mkdir ghsetup && cd ghsetup
ghver=2.0.0
wget https://github.com/cli/cli/releases/download/v$ghver/gh_${ghver}_linux_amd64.tar.gz
tar xf gh_${ghver}_linux_amd64.tar.gz
sudo mv gh_${ghver}_linux_amd64/bin/gh /usr/bin/gh
cd .. && rm -r ghsetup
cd cbot
git remote add upstream https://github.com/brenns10/cbot
- setup: |
cd cbot
meson build
- build: |
cd cbot
ninja -C build
- source_release: |
case $GIT_REF in refs/tags/*) true;; *) exit 0;; esac
TAG=${GIT_REF#refs/tags/}
cd cbot
./make-release.sh $TAG
mkdir -p ~/artifacts
mv cbot-${TAG#v}.tar.gz ~/artifacts/
- alpine_package: |
case $GIT_REF in refs/tags/*) true;; *) exit 0;; esac
TAG=${GIT_REF#refs/tags/}
cd cbot
export PACKAGER_PRIVKEY=~/packager.key
sudo cp deploy/stephen@brennan.io.rsa.pub /etc/apk/keys/
export PACKAGER_PUBKEY=~/cbot/deploy/stephen@brennan.io.rsa.pub
cd deploy/alpine
cp ~/artifacts/cbot-${TAG#v}.tar.gz .
sed -i 's?source=.*$?source="'cbot-${TAG#v}.tar.gz'"?' APKBUILD
abuild checksum
abuild
mv ~/packages/deploy/x86_64/cbot-${TAG#v}-r0.apk ~/artifacts/
- github_release: |
case $GIT_REF in refs/tags/*) true;; *) exit 0;; esac
TAG=${GIT_REF#refs/tags/}
set +x; source ~/.github_token; set -x
cd cbot
# Get the blurb for the current release from CHANGELOG
sed <CHANGELOG \
-e '1,/^[[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+ ([[:digit:]]\{4\}/d' \
-e '/^[[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+ ([[:digit:]]\{4\}/,$d' \
-e '/^-\+$/d' \
-e '/./,$!d' | tac | sed '/./,$!d' | tac > /tmp/changelog
gh release create $TAG ~/artifacts/* -t $TAG -F /tmp/changelog
- docker_build: |
case $GIT_REF in refs/tags/*) true;; *) exit 0;; esac
TAG=${GIT_REF#refs/tags/}
set +x; source ~/.github_token; set -x
cd cbot/deploy
cp ~/artifacts/cbot-${TAG#v}-r0.apk cbot.apk
sudo service docker start
sudo docker login docker.io -u brenns10 --password-stdin < ~/.dockerpw
sudo docker build -t brenns10/cbot:$TAG .
sudo docker tag brenns10/cbot:$TAG brenns10/cbot:latest
sudo docker push -a docker.io/brenns10/cbot