-
Notifications
You must be signed in to change notification settings - Fork 16
/
.jobserv.yml
35 lines (30 loc) · 1.18 KB
/
.jobserv.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
timeout: 30
triggers:
- name: create-release
type: git_poller
params:
GIT_URL: "https://github.com/doanac/fioctl.git"
GIT_POLL_REFS: "refs/tags/*"
runs:
- name: create-binaries
container: golang:1.19.0
host-tag: amd64
script: create-binaries
scripts:
create-binaries: |
#!/bin/sh -e
make
GH_REPO="https://api.github.com/repos/foundriesio/fioctl"
GH_TAGS="$GH_REPO/releases/tags/$tag"
AUTH="Authorization: token $(cat /secrets/githubtok)"
# Validate token.
curl -o /dev/null -sH "$AUTH" $GH_REPO || { echo "Error: Invalid repo, token or network issue!"; exit 1; }
response=$(curl -sH "$AUTH" $GH_TAGS)
eval $(echo "$response" | grep -m 1 "id.:" | grep -w id | tr : = | tr -cd '[[:alnum:]]=')
[ "$id" ] || { echo "Error: Failed to get release id for tag: $tag"; echo "$response" | awk 'length($0)<100' >&2; exit 1; }
cd bin
for filename in `ls`; do
echo "Uploading $filename ..."
GH_ASSET="https://uploads.github.com/repos/foundriesio/fioctl/releases/$id/assets?name=$filename)"
curl --data-binary @"$filename" -H "$AUTH" -H "Content-Type: application/octet-stream" $GH_ASSET
done