forked from elgatito/elementum-surge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate.sh
executable file
·41 lines (31 loc) · 1.21 KB
/
generate.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
#!/bin/bash
CWD=$(pwd)
GIT_VERSION=$(git rev-parse HEAD)
mkdir -p static/packages
for plugin in "elgatito/plugin.video.elementum" "elgatito/script.elementum.burst" "elgatito/context.elementum" "ElementumOrg/service.lt2http" "ElementumOrg/repository.elementumorg"; do
cd ${CWD}
go run generator.go ${plugin}
cd ${CWD}/static/packages
mkdir -p ${plugin}
cd ${plugin}
rm -f *
VERSION=$(curl -H "Authorization: token $GH_TOKEN" https://api.github.com/repos/${plugin}/releases/latest -s | jq .name -r)
VERSION="v${VERSION}"
wget --header="Authorization: token $GH_TOKEN" https://raw.githubusercontent.com/${plugin}/${VERSION}/addon.xml
echo -n ${VERSION} >> release
done
cd ${CWD}/src/
hugo -d dist/ && cp -Rf dist/* ../static/
# Upload to Surge
surge -p ${CWD}/static/ -d elementum.surge.sh
# Upload to Github
rm -rf remote
git config --global push.default simple
git clone --depth=1 https://github.com/ElementumOrg/elementumorg.github.io remote
cp -Rf ${CWD}/static/* remote/
cd remote && \
git add * && git commit -m "Update to ${GIT_VERSION}"
git remote add static https://$GH_USER:[email protected]/ElementumOrg/elementumorg.github.io && \
git push static master && \
cd .. && \
rm -rf remote