Skip to content
This repository was archived by the owner on Sep 8, 2018. It is now read-only.

Commit 79e4eac

Browse files
author
Bjornskjald
committed
initial commit
0 parents  commit 79e4eac

File tree

6 files changed

+164
-0
lines changed

6 files changed

+164
-0
lines changed

functions.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
download_dependencies () {
2+
get_script package-mac.sh
3+
get_script snap.sh
4+
get_script gh-upload.sh
5+
get_script makeself.sh
6+
7+
get_asset Miscord.app.zip
8+
get_asset snap.zip
9+
get_asset makeself.zip
10+
}
11+
12+
get_script () {
13+
wget "https://raw.githubusercontent.com/Bjornskjald/miscord-build-scripts/master/$1" -O "scripts/$1"
14+
chmod +x "scripts/$1"
15+
}
16+
get_asset () {
17+
wget "https://github.com/Bjornskjald/miscord-build-scripts/releases/download/assets/$1" -O "assets/$1"
18+
unzip "assets/$1"
19+
}
20+
21+
create_release () {
22+
AUTH="Authorization: token $GITHUB_API_TOKEN"
23+
local URL="https://api.github.com/repos/Bjornskjald/miscord/releases"
24+
local DATA='{"tag_name":"v'$VERSION'","target_commitish": "master","name": "'$VERSION'","body": "Release created automatically from Travis build.","draft": false,"prerelease": false}'
25+
curl -v -i -X POST -H "Content-Type:application/json" -H $AUTH $URL -d
26+
}

gh-upload.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Author: Stefan Buck
4+
# License: MIT
5+
# https://gist.github.com/stefanbuck/ce788fee19ab6eb0b4447a85fc99f447
6+
7+
echo "Uploading asset $2..."
8+
9+
set -e
10+
xargs=$(which gxargs || which xargs)
11+
12+
# Validate settings.
13+
[ "$TRACE" ] && set -x
14+
15+
# Define variables.
16+
GH_REPO="repos/Bjornskjald/miscord"
17+
WGET_ARGS="--content-disposition --auth-no-challenge --no-cookie"
18+
CURL_ARGS="-LJO#"
19+
20+
# Read asset tags.
21+
response=$(curl -sH "$AUTH" "https://api.github.com/$GH_REPO/releases/latest")
22+
23+
# Get ID of the asset based on given filename.
24+
eval $(echo "$response" | grep -m 1 "id.:" | grep -w id | tr : = | tr -cd '[[:alnum:]]=')
25+
[ "$id" ] || { echo "Error: Failed to get release id for tag: $tag"; echo "$response" | awk 'length($0)<100' >&2; exit 1; }
26+
27+
FILENAME=$(echo $2 | sed s/-/-$VERSION-/)
28+
29+
# Construct url
30+
GH_ASSET="https://uploads.github.com/$GH_REPO/releases/$id/assets?name=$(basename $FILENAME)"
31+
32+
curl "$GITHUB_OAUTH_BASIC" --data-binary @"$2" -H $AUTH -H "Content-Type: application/octet-stream" -o /dev/null $GH_ASSET

make.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/bash
2+
3+
# Import all functions from other files
4+
source scripts/functions.sh
5+
source scripts/makeself.sh
6+
7+
VERSION=$(node -pe "require('./package.json').version")
8+
echo "Building Miscord v$VERSION..."
9+
10+
mkdir -p build
11+
12+
echo "Downloading dependencies..."
13+
download_dependencies
14+
15+
npm run build:linux -- -o build/miscord-linux-x64 &
16+
# npm run build:linux32 -- -o build/miscord-$VERSION-linux-x86 &
17+
npm run build:win -- -o build/miscord-win.exe &
18+
# npm run build:win32 -- -o build/miscord-$VERSION-win-x86.exe &
19+
npm run build:mac -- -o build/miscord-macos &
20+
wait
21+
22+
makeself_linux_x64 &
23+
# makeself_linux_x86 &
24+
makeself_mac &
25+
wait
26+
27+
28+
source scripts/package-mac.sh
29+
30+
create_release
31+
32+
for file in build/miscord-*; do
33+
scripts/gh-upload.sh $file
34+
done
35+
36+
source scripts/snap.sh
37+
38+
echo "Finished."

makeself.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
makeself_linux_x64 () {
2+
local DIR="tmp-ms-linux-x64"
3+
4+
mkdir $DIR
5+
mv build/miscord-$VERSION-linux-x64 $DIR
6+
makeself $DIR miscord-$VERSION-linux-x64
7+
mv miscord-$VERSION-linux-x64.run build/
8+
rm -r $DIR
9+
}
10+
11+
makeself_linux_x86 () {
12+
local DIR="tmp-ms-linux-x86"
13+
14+
mkdir $DIR
15+
mv build/miscord-$VERSION-linux-x86 $DIR
16+
makeself $DIR miscord-$VERSION-linux-x86
17+
mv miscord-$VERSION-linux-x86.run build/
18+
rm -r $DIR
19+
}
20+
21+
makeself_mac () {
22+
local DIR="tmp-ms-mac"
23+
24+
mkdir $DIR
25+
cp build/miscord-$VERSION-macos $DIR
26+
makeself $DIR miscord-$VERSION-macos
27+
mv miscord-$VERSION-macos.run build/
28+
rm -r $DIR
29+
}
30+
31+
makeself () {
32+
assets/makeself/makeself.sh --gzip $1 $2.run "Miscord" ./$2
33+
}

package-mac.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
cp -r assets/Miscord.app build/
4+
5+
pushd $BUILD_DIR
6+
7+
sed s/%version-here%/$VERSION/g Miscord.app/Contents/Info.plist > Miscord.app/Contents/Info.plist
8+
mv miscord-macos Miscord.app/Contents/Resources/script
9+
10+
zip -r miscord-$1-macos.zip Miscord.app
11+
rm -r Miscord.app
12+
13+
popd

snap.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
3+
SNAP_CONFIG=$HOME/.config/snapcraft/
4+
5+
mkdir -p build/snap-x64/{snap,prime/bin}
6+
# mkdir -p build/snap-x86/{snap,prime/bin}
7+
8+
cp build/miscord-linux-x64.run build/snap-x64/prime/bin/miscord
9+
cp assets/snap/icon.png build/snap-x64/
10+
sed s/%version-here%/$1/ assets/snap/snapcraft.yaml | sed 's/%arch-here%/amd64/' > build/snap-x64/snapcraft.yaml
11+
pushd build/snap-x64
12+
docker run --rm -v $PWD:$PWD -w $PWD snapcore/snapcraft snapcraft
13+
docker run --rm -v $PWD:$PWD -v $SNAP_CONFIG:$SNAP_CONFIG -w $PWD snapcore/snapcraft snapcraft push miscord_$1_amd64.snap --release=stable
14+
popd
15+
16+
# cp build/miscord-linux-x86.run build/snap-x86/prime/bin/miscord
17+
# cp assets/snap/icon.png build/snap-x86/
18+
# sed s/%version-here%/$1/ assets/snap/snapcraft.yaml | sed 's/%arch-here%/i386/' > build/snap-x86/snapcraft.yaml
19+
# pushd build/snap-x86
20+
# docker run --rm -v $PWD:$PWD -w $PWD snapcore/snapcraft snapcraft
21+
# docker run --rm -v $PWD:$PWD -v $SNAP_CONFIG:$SNAP_CONFIG -w $PWD snapcore/snapcraft snapcraft push miscord_$1_amd64.snap --release=stable
22+
# popd

0 commit comments

Comments
 (0)