-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathversion.sh
More file actions
executable file
·18 lines (16 loc) · 838 Bytes
/
Copy pathversion.sh
File metadata and controls
executable file
·18 lines (16 loc) · 838 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/bash
set -euxo pipefail
user="${1}"
repo="${2}"
token="${3}"
gh="https://api.github.com/repos/${user}/${repo}"
c="curl -sfL -u ${user}:${token}"
currentversion=$(${c} ${gh}/releases | jq -r '.[0].name' | tr -d v)
version="v$(echo "${currentversion} + 0.01" | bc)"
grep "version = \"${version}\"" main.go || (echo "Wrong version in main.go" && exit 1)
grep "userd ${version}" README.md || (echo "Wrong version in README.md" && exit 1)
git tag ${version} || true
git push origin master
release=$(${c} -XPOST ${gh}/releases -d '{ "tag_name": "'${version}'", "target_commitish": "master", "name": "'${version}'", "body": "'${version}'", "draft": false, "prerelease": false }')
url=$(echo "${release}" | jq -r .upload_url | cut -f1 -d'{')
$c -XPOST ${url}?name=${repo} --data-binary @./userd -H "Content-Type: application/binary"