-
Notifications
You must be signed in to change notification settings - Fork 45
/
Copy pathrelease.sh
executable file
·49 lines (36 loc) · 1.25 KB
/
release.sh
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
#!/bin/bash
set -x
set -e
if git diff-index --quiet HEAD --; then
echo "Clean repo, good!"
else
echo "Dirty repo, commit before running."
exit 1
fi
CURRENT_VERSION=$(git describe --abbrev=0)
VERSION_MATCH='v\([0-9]\+\)\.\([0-9]\+\)'
MAJOR_VERSION=$(echo $CURRENT_VERSION | sed -e"s/$VERSION_MATCH/\1/")
MINOR_VERSION=$(echo $CURRENT_VERSION | sed -e"s/$VERSION_MATCH/\2/")
echo "Current version: $CURRENT_VERSION"
# Work out the next version
NEXT_VERSION="v$MAJOR_VERSION.$((MINOR_VERSION+1))"
echo "Next version: $NEXT_VERSION"
OUTDIR=releases/$NEXT_VERSION
mkdir $OUTDIR
# Update the version embedded in the PCB
sed -e"s/(gr_text \"tomu.im $CURRENT_VERSION\"/(gr_text \"tomu.im $NEXT_VERSION\"/" --in-place=.bak pcb/tomu.kicad_pcb
git add pcb/tomu.kicad_pcb
# Generate the gerber files
python2 third_party/gen_gerber_and_drill_files_board.py tomu.kicad_pcb $OUTDIR/gerbers
cp pcb/tomu.kicad_pcb $OUTDIR/gerbers/
git add $OUTDIR/gerbers/*
# Update the kitspace.yaml
sed -e"s/$CURRENT_VERSION/$NEXT_VERSION/" kitspace.yaml --in-place
git add kitspace.yaml
git commit -m "Bumping version to $NEXT_VERSION"
git tag --annotate $NEXT_VERSION -m"Releasing $NEXT_VERSION"
cd $OUTDIR/gerbers
ZIP="tomu-$(git describe --long).zip"
zip -r ../$ZIP .
cd ..; md5sum $ZIP
exit 0