aboutsummaryrefslogtreecommitdiff
path: root/auto-void-packages/commit-push-pr.sh
blob: 687adc7f3c6175e8b316b01fc60c9956eea1934b (plain)
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
#!/usr/bin/env bash
#Clyhtsuriva


helpy(){
printf "command: %s <package> <version> <tested> [path]\n" "$0"
printf "package: package name\n"
printf "version: version update\n"
printf "tested: yes/briefly/no\n"
printf "path (optional): path of architectures file, defaults to '\$HOME/workbench/auto-void-packages/architectures.txt'\n"
}

###

[ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ] && helpy && exit 1
PKG="$1"
VER="$2"
tested="$3"
archs_fp="${4:-$HOME/workbench/auto-void-packages/architectures.txt}"

# The third variable must be yes, briefly or no
[[ ! $tested =~ (yes|briefly|no) ]] && helpy && exit 1

###

printf "Updating %s to %s.\n" "$PKG" "$VER"

pushd ~/workbench/void-packages || exit 1

# git stuff
git add "srcpkgs/$PKG" && \
	git commit -m "$PKG: update to $VER" && \
	git push origin "$PKG-update"

ARCHS=$(/bin/cat "$archs_fp")

# github stuff
gh pr create \
	--title "$PKG: update to $VER" \
	--body "#### Testing the changes
- I tested the changes in this PR: **$tested**

#### Local build testing
- I built this PR locally for my native architecture, x86_64
- I crossbuilded this PR locally for these architectures:
$ARCHS" \
	--base master \
	--head "clyhtsuriva:$PKG-update"

popd || exit 1