File tree Expand file tree Collapse file tree 3 files changed +94
-2
lines changed Expand file tree Collapse file tree 3 files changed +94
-2
lines changed Original file line number Diff line number Diff line change @@ -9,3 +9,4 @@ scripts/build-config-custom.js
9
9
scripts /build-config- * .js
10
10
kitchen-sink /vue /js /app.js
11
11
kitchen-sink /react /js /app.js
12
+ .github-access-token
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+ #
3
+ # Author: Stefan Buck
4
+ # License: MIT
5
+ # https://gist.github.com/stefanbuck/ce788fee19ab6eb0b4447a85fc99f447
6
+ #
7
+ #
8
+ # This script accepts the following parameters:
9
+ #
10
+ # * tag
11
+ # * filename
12
+ # * github_api_token
13
+ #
14
+ # Script to upload a release asset using the GitHub API v3.
15
+ #
16
+ # Example:
17
+ #
18
+ # upload-github-release-asset.sh github_api_token=TOKEN owner=stefanbuck repo=playground tag=v0.1.0 filename=./build.zip
19
+ #
20
+
21
+ # Check dependencies.
22
+ set -e
23
+ xargs=$( which gxargs || which xargs)
24
+
25
+ # Validate settings.
26
+ [ " $TRACE " ] && set -x
27
+
28
+ CONFIG=$@
29
+
30
+ for line in $CONFIG ; do
31
+ eval " $line "
32
+ done
33
+
34
+ # Define variables.
35
+ GH_API=" https://api.github.com"
36
+ GH_REPO=" $GH_API /repos/framework7io/framework7"
37
+ GH_TAGS=" $GH_REPO /releases/tags/$tag "
38
+ AUTH=" Authorization: token $github_api_token "
39
+ WGET_ARGS=" --content-disposition --auth-no-challenge --no-cookie"
40
+ CURL_ARGS=" -LJO#"
41
+
42
+ if [[ " $tag " == ' LATEST' ]]; then
43
+ GH_TAGS=" $GH_REPO /releases/latest"
44
+ fi
45
+
46
+ # Validate token.
47
+ curl -o /dev/null -sH " $AUTH " $GH_REPO || { echo " Error: Invalid repo, token or network issue!" ; exit 1; }
48
+
49
+ # Read asset tags.
50
+ response=$( curl -sH " $AUTH " $GH_TAGS )
51
+
52
+ # Get ID of the asset based on given filename.
53
+ eval $( echo " $response " | grep -m 1 " id.:" | grep -w id | tr : = | tr -cd ' [[:alnum:]]=' )
54
+ [ " $id " ] || { echo " Error: Failed to get release id for tag: $tag " ; echo " $response " | awk ' length($0)<100' >&2 ; exit 1; }
55
+
56
+ # Upload asset
57
+ echo " Uploading asset... "
58
+
59
+ # Construct url
60
+ GH_ASSET=" https://uploads.github.com/repos/framework7io/framework7/releases/$id /assets?name=$( basename $filename ) "
61
+
62
+ curl " $GITHUB_OAUTH_BASIC " --data-binary @" $filename " -H " Authorization: token $github_api_token " -H " Content-Type: application/octet-stream" $GH_ASSET
Original file line number Diff line number Diff line change @@ -62,11 +62,40 @@ if [[ $REPLY =~ ^[Yy]$ ]]; then
62
62
63
63
# commit
64
64
git add -A
65
- git add -f \
66
- packages/** /* .*
65
+ git add -f packages/** /* .*
67
66
git commit -m " $VERSION Release"
68
67
69
68
# publish
70
69
git push origin refs/tags/v" $VERSION "
71
70
git push
71
+
72
+ # Create assets
73
+ (
74
+ (
75
+ cd packages/core
76
+ tar -zcvf ../framework7.tar.gz ./*
77
+ zip -r ../framework7.zip ./*
78
+ )
79
+ (
80
+ cd packages/react
81
+ tar -zcvf ../framework7-react.tar.gz ./*
82
+ zip -r ../framework7-react.zip ./*
83
+ )
84
+ (
85
+ cd packages/vue
86
+ tar -zcvf ../framework7-vue.tar.gz ./*
87
+ zip -r ../framework7-vue.zip ./*
88
+ )
89
+ )
90
+
91
+ # Read TOKEN
92
+ token=$( < ./.github-access-token)
93
+
94
+ # Upload assets
95
+ source " scripts/release-asset.sh" github_api_token=$token tag=v$VERSION filename=../packages/framework7.tar.gz
96
+ source " scripts/release-asset.sh" github_api_token=$token tag=v$VERSION filename=../packages/framework7.zip
97
+ source " scripts/release-asset.sh" github_api_token=$token tag=v$VERSION filename=../packages/framework7-react.tar.gz
98
+ source " scripts/release-asset.sh" github_api_token=$token tag=v$VERSION filename=../packages/framework7-react.zip
99
+ source " scripts/release-asset.sh" github_api_token=$token tag=v$VERSION filename=../packages/framework7-vue.tar.gz
100
+ source " scripts/release-asset.sh" github_api_token=$token tag=v$VERSION filename=../packages/framework7-vue.zip
72
101
fi
You can’t perform that action at this time.
0 commit comments