Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Cesium
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
bpresles
Cesium
Commits
10ee44d4
Commit
10ee44d4
authored
6 years ago
by
Benoit Lavenier
Browse files
Options
Downloads
Patches
Plain Diff
[fix] validating TX has not uid and avatar - Fix #729
[enh] release.sh use github token
parent
25dbb1dc
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
github.sh
+40
-24
40 additions, 24 deletions
github.sh
release.sh
+11
-8
11 additions, 8 deletions
release.sh
www/js/services/cache-services.js
+2
-1
2 additions, 1 deletion
www/js/services/cache-services.js
www/js/services/tx-services.js
+1
-2
1 addition, 2 deletions
www/js/services/tx-services.js
with
54 additions
and
35 deletions
github.sh
+
40
−
24
View file @
10ee44d4
...
...
@@ -13,58 +13,74 @@ fi
current
=
`
grep
-P
"version
\"
:
\"\d
+.
\d
+.
\d
+(
\w
*)"
package.json |
grep
-oP
"
\d
+.
\d
+.
\d
+(
\w
*)"
`
echo
"Current version:
$current
"
### Get repo URL
REMOTE_URL
=
`
git remote
-v
|
grep
-P
"push"
|
grep
-oP
"https://github.com/[^/]+/[^/ ]+"
`
REPO
=
`
echo
$REMOTE_URL
|
sed
"s/https:
\/\/
github.com
\/
//g"
`
REPO_URL
=
https://api.github.com/repos/
$REPO
### get auth token
GITHUB_TOKEN
=
`
cat
~/.config/duniter/.github
`
if
[[
"_
$GITHUB_TOKEN
"
!=
"_"
]]
;
then
GITHUT_AUTH
=
"Authorization: token
$GITHUB_TOKEN
"
else
echo
"Unable to find github authentifcation token file: "
echo
" - You can create such a token at https://github.com/settings/tokens > 'Generate a new token'."
echo
" - Then copy the token and paste it in the file '~/.config/duniter/.github' using a valid token."
exit
fi
case
"
$1
"
in
del
)
if
[[
$2
=
~ ^[a-zA-Z0-9_]+:[a-zA-Z0-9_]+
$
]]
;
then
result
=
`
curl
-i
'https://api.github.com/repos/duniter/cesium/releases/tags/v'
"
$current
"
''
`
release_url
=
`
echo
"
$result
"
|
grep
-P
"
\"
url
\"
:
\"
[^
\"
]+"
|
grep
-oP
"https://api.github.com/repos/duniter/cesium/releases/
\d
+"
`
if
[[
$release_url
!=
""
]]
;
then
result
=
`
curl
-i
"
$REPO_URL
/releases/tags/v
$current
"
`
release_url
=
`
echo
"
$result
"
|
grep
-P
"
\"
url
\"
:
\"
[^
\"
]+"
|
grep
-oP
"
$REPO_URL
/releases/
\d
+"
`
if
[[
$release_url
!=
""
]]
;
then
echo
"Deleting existing release..."
curl
-XDELETE
$release_url
-u
$2
fi
else
echo
"Wrong argument"
echo
"Usage:"
echo
" > ./github.sh del user:password"
exit
curl
-H
'Authorization: token $GITHUB_TOKEN'
-XDELETE
$release_url
fi
;;
pre|rel
)
if
[[
$2
=
~ ^[a-zA-Z0-9_]+:[a-zA-Z0-9_]+
$
&&
$3
!=
""
]]
;
then
if
[[
$2
!=
""
]]
;
then
if
[[
$1
=
"pre"
]]
;
then
prerelease
=
"true"
else
prerelease
=
"false"
fi
description
=
`
echo
$2
`
result
=
`
curl
-
i
'https://api.github.com/repos/duniter/cesium
/releases/tags/v
'
"
$current
"
''
`
release_url
=
`
echo
"
$result
"
|
grep
-P
"
\"
url
\"
:
\"
[^
\"
]+"
|
grep
-oP
"https://
api.github.com/repos/duniter/cesium
/releases/
\d
+"
`
result
=
`
curl
-
s
-H
''
"
$GITHUT_AUTH
"
''
"
$REPO_URL
/releases/tags/v
$current
"
`
release_url
=
`
echo
"
$result
"
|
grep
-P
"
\"
url
\"
:
\"
[^
\"
]+"
|
grep
-oP
"https://
[A-Za-z0-9/.-]+
/releases/
\d
+"
`
if
[[
$release_url
!=
""
]]
;
then
echo
"Deleting existing release..."
curl
-XDELETE
$release_url
-u
$2
result
=
`
curl
-H
''
"
$GITHUT_AUTH
"
''
-XDELETE
$release_url
`
if
[[
"_
$result
"
!=
"_"
]]
;
then
error_message
=
`
echo
"
$result
"
|
grep
-P
"
\"
message
\"
:
\"
[^
\"
]+"
|
grep
-oP
":
\"
[^
\"
]+
\"
"
`
echo
"Delete existing release failed with error
$error_message
"
exit
fi
else
echo
"Release not exists yet on github."
fi
echo
"Creating new release..."
result
=
`
curl
-i
https://api.github.com/repos/duniter/cesium/releases
-u
$2
-d
'{"tag_name": "v'
"
$current
"
'","target_commitish": "master","name": "'
"
$current
"
'","body": "'
"
$3
"
'","draft": false,"prerelease": '
"
$prerelease
"
'}'
`
upload_url
=
`
echo
"
$result
"
|
grep
-P
"
\"
upload_url
\"
:
\"
[^
\"
]+"
|
grep
-oP
"https://[a-z0-9/.]+"
`
echo
" - tag: v
$current
"
echo
" - description:
$description
"
result
=
`
curl
-H
''
"
$GITHUT_AUTH
"
''
-i
$REPO_URL
/releases
-d
'{"tag_name": "v'
"
$current
"
'","target_commitish": "master","name": "'
"
$current
"
'","body": "'
"
$description
"
'","draft": false,"prerelease": '
"
$prerelease
"
'}'
`
upload_url
=
`
echo
"
$result
"
|
grep
-P
"
\"
upload_url
\"
:
\"
[^
\"
]+"
|
grep
-oP
"https://[A-Za-z0-9/.-]+"
`
### Sending files
echo
"Uploading files to GitHub..."
dirname
=
`
pwd
`
curl
-i
-u
$2
-H
'Content-Type: application/zip'
-T
$dirname
/platforms/web/build/cesium-v
$current
-web
.zip
$upload_url
?name
=
cesium-v
$current
-web
.zip
curl
-i
-u
$2
-H
'Content-Type: application/vnd.android.package-archive'
-T
$dirname
/platforms/android/build/outputs/apk/release/android-release.apk
$upload_url
?name
=
cesium-v
$current
-android
.apk
# curl -i -u $2 -H 'Content-Type: application/zip' -T $dirname/platforms/firefoxos/build/package.zip $upload_url?name=cesium-v$current-firefoxos.zip
# curl -i -u $2 -H 'Content-Type: application/x-debian-package' -T $dirname/platforms/ubuntu/native/cesium_${current}_amd64.deb $upload_url?name=cesium-v${current}-ubuntu-amd64.deb
curl
-i
-H
''
"
$GITHUT_AUTH
"
''
-H
'Content-Type: application/zip'
-T
$dirname
/platforms/web/build/cesium-v
$current
-web
.zip
$upload_url
?name
=
cesium-v
$current
-web
.zip
curl
-i
-H
''
"
$GITHUT_AUTH
"
''
-H
'Content-Type: application/vnd.android.package-archive'
-T
$dirname
/platforms/android/build/outputs/apk/release/android-release.apk
$upload_url
?name
=
cesium-v
$current
-android
.apk
echo
"Successfully uploading files"
release_url
=
`
echo
"
$result
"
|
grep
-P
"
\"
url
\"
:
\"
[^
\"
]+"
|
grep
-oP
"https://api.github.com/repos/[a-z0-9/.]+"
`
echo
" -> Release url:
$release_url
"
echo
" -> Release url: https://github.com/
$REPO
/releases/tag/v
$current
"
else
echo
"Wrong arguments"
echo
"Usage:"
echo
" > ./github.sh pre|rel
user:password
<release_description>"
echo
" > ./github.sh pre|rel <release_description>"
echo
"With:"
echo
" - pre: use for pre-release"
echo
" - rel: for full release"
...
...
This diff is collapsed.
Click to expand it.
release.sh
+
11
−
8
View file @
10ee44d4
...
...
@@ -40,6 +40,11 @@ if [[ $2 =~ ^[0-9]+.[0-9]+.[0-9]+((a|b)[0-9]+)?$ && $3 =~ ^[0-9]+$ ]]; then
;;
esac
# Load env.sh if exists
if
[
-f
"
${
DIRNAME
}
/env.sh"
]
;
then
source
${
DIRNAME
}
/env.sh
fi
# force nodejs version to 5
if
[
-d
"
$NVM_DIR
"
]
;
then
.
$NVM_DIR
/nvm.sh
...
...
@@ -60,7 +65,6 @@ if [[ $2 =~ ^[0-9]+.[0-9]+.[0-9]+((a|b)[0-9]+)?$ && $3 =~ ^[0-9]+$ ]]; then
echo
"----------------------------------"
echo
"- Building Android artifact..."
echo
"----------------------------------"
source
./env.sh
ionic build android
--release
#ionic build firefoxos --release
...
...
@@ -91,12 +95,12 @@ if [[ $2 =~ ^[0-9]+.[0-9]+.[0-9]+((a|b)[0-9]+)?$ && $3 =~ ^[0-9]+$ ]]; then
echo
" Waiting 30s, for propagation to github..."
sleep
30s
if
[[
$4
=
~ ^[a-zA-Z0-9_]+:[a-zA-Z0-9_]+
$
&&
"_
$
5
"
!=
"_"
]]
;
then
if
[[
"_
$
4
"
!=
"_"
]]
;
then
echo
"**********************************"
echo
"* Uploading artifacts to Github..."
echo
"**********************************"
./github.sh
$1
$4
"'"
$5
"'"
./github.sh
$1
$4
echo
"----------------------------------"
echo
"- Building desktop versions..."
...
...
@@ -129,12 +133,11 @@ cesium-desktop-v$2-linux-x64.tar.gz"
echo
"* Build release succeed !"
echo
"**********************************"
echo
" WARN - missing arguments: "
echo
" user:password 'release_description'"
echo
" WARN - missing arguments 'release_description'"
echo
echo
" Binaries files NOT sending to github repository"
echo
" Please run:"
echo
" > ./github.sh pre|rel
user:password
'release_description'"
echo
" > ./github.sh pre|rel 'release_description'"
echo
echo
" Desktop artifact are NOT build"
echo
" Please run:"
...
...
@@ -145,10 +148,10 @@ cesium-desktop-v$2-linux-x64.tar.gz"
else
echo
"Wrong version format"
echo
"Usage:"
echo
" > ./release.sh [pre|rel] <version> <android-version> <
github_credentials
>"
echo
" > ./release.sh [pre|rel] <version> <android-version> <
release_description
>"
echo
"with:"
echo
" version: x.y.z"
echo
" android-version: nnn"
echo
"
github_credentials: user:password (a valid GitHub user account)
"
echo
"
release_description: a short description of the release
"
fi
This diff is collapsed.
Click to expand it.
www/js/services/cache-services.js
+
2
−
1
View file @
10ee44d4
...
...
@@ -5,7 +5,8 @@ angular.module('cesium.cache.services', ['angular-cache'])
var
constants
=
{
LONG
:
1
*
60
*
60
*
1000
/*5 min*/
,
LONG
:
1
*
60
*
60
*
1000
/*1 hour*/
,
MEDIUM
:
5
*
60
*
1000
/*5 min*/
,
SHORT
:
csSettings
.
defaultSettings
.
cacheTimeMs
},
cacheNames
=
[]
...
...
This diff is collapsed.
Click to expand it.
www/js/services/tx-services.js
+
1
−
2
View file @
10ee44d4
...
...
@@ -159,7 +159,6 @@ angular.module('cesium.tx.services', ['ngApi', 'cesium.bma.services',
var
sliceTime
=
csSettings
.
data
.
walletHistorySliceSecond
;
fromTime
=
fromTime
-
(
fromTime
%
sliceTime
);
for
(
var
i
=
fromTime
;
i
-
sliceTime
<
nowInSec
;
i
+=
sliceTime
)
{
var
startTime
=
Math
.
max
(
i
,
fromTime
);
jobs
.
push
(
BMA
.
tx
.
history
.
times
({
pubkey
:
pubkey
,
from
:
i
,
to
:
i
+
sliceTime
-
1
})
.
then
(
_reduceTx
)
);
...
...
@@ -361,7 +360,7 @@ angular.module('cesium.tx.services', ['ngApi', 'cesium.bma.services',
data
.
balance
=
balance
;
// Will add uid (+ plugin will add name, avatar, etc. if enable)
return
csWot
.
extendAll
((
data
.
tx
.
history
||
[]).
concat
(
data
.
tx
.
pendings
||
[]),
'
pubkey
'
);
return
csWot
.
extendAll
((
data
.
tx
.
history
||
[]).
concat
(
data
.
tx
.
validating
||
[]).
concat
(
data
.
tx
.
pendings
||
[]),
'
pubkey
'
);
})
.
then
(
function
()
{
console
.
debug
(
'
[tx] TX and sources loaded in
'
+
(
new
Date
().
getTime
()
-
now
)
+
'
ms
'
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment