-
-
Notifications
You must be signed in to change notification settings - Fork 16
/
publish_git.sh
executable file
·58 lines (41 loc) · 1019 Bytes
/
publish_git.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
50
51
52
53
54
55
56
57
58
#!/usr/bin/env bash
#
# Copyright (c) 2022-2023 Carbon Community
# All rights reserved.
#
HOME=$(pwd)
TEMP="$(dirname "$0")/../../../Carbon.Core/.tmp"
if [ ! -d "$TEMP" ]; then
mkdir -p "$TEMP"
fi
git fetch --tags
echo "** Git Metadata:"
for tag in $(git tag -l); do
git tag -d "$tag"
done
git fetch --tags
cd "$TEMP"
git branch --show-current > .gitbranch
echo "** Branch done."
git rev-parse --short HEAD > .gitchs
echo "** Hash-short done."
git rev-parse --long HEAD > .gitchl
echo "** Hash-long done."
git show -s --format="%an" HEAD > .gitauthor
echo "** Author done."
git log -1 --pretty="%B" HEAD > .gitcomment
echo "** Comment done."
git log -1 --format="%ci" HEAD > .gitdate
echo "** Date done."
if [ -z "$1" ]; then
git describe --tags > .gittag
echo "** Tag done."
else
echo "$1" > .gittag
echo "** Tag done."
fi
git remote get-url origin > .giturl
echo "** URL done."
git log -1 --name-status --format="" > .gitchanges
echo "** Changes done."
cd "$HOME"