Skip to content

Commit 179fd87

Browse files
committed
Deploy docs using Jenkins instead of Travis
1 parent d6d4606 commit 179fd87

File tree

7 files changed

+37
-194
lines changed

7 files changed

+37
-194
lines changed

crowdin.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
project_identifier: sponge-docs
2-
base_url: https://api.crowdin.com
2+
api_key_env: CROWDIN_API_KEY
33

44
files:
5-
-
6-
source: '/locale-src/en/LC_MESSAGES/**/*.po'
5+
- source: '/locale-src/en/LC_MESSAGES/**/*.po'
76
translation: '/locale/%locale_with_underscore%/LC_MESSAGES/**/%original_file_name%'

etc/build.sh

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -20,40 +20,6 @@ else
2020
python ./etc/reporter.py pass
2121
fi
2222

23-
# strip the branchname and make it a variable
24-
if [[ $TRAVIS_BRANCH =~ release\/[0-9]*\.[0-9]*\.[0-9]* ]]; then
25-
26-
export BRANCHNAME=`sed 's/release\///' <<<$TRAVIS_BRANCH`
27-
28-
else
29-
30-
export BRANCHNAME=$TRAVIS_BRANCH
31-
32-
fi
33-
34-
echo "$TRAVIS_BRANCH"
35-
echo "$BRANCHNAME"
36-
37-
# If we're on master or a release/* branch, deploy
38-
39-
if [[ $TRAVIS_PULL_REQUEST = false && $TRAVIS_BRANCH = master ]]; then
40-
41-
# Add the api key to the crowdin configuration (because it is stupid)
42-
echo -e \\napi_key: ${CROWDIN_API_KEY} >> ./crowdin.yaml
43-
44-
# Deploy docs
45-
./etc/docs.sh
46-
47-
elif [[ $TRAVIS_PULL_REQUEST = false && $BRANCHNAME =~ [0-9]*\.[0-9]*\.[0-9]* ]]; then
48-
49-
# Add the api key to the crowdin configuration (because it is stupid)
50-
echo -e \\napi_key: ${CROWDIN_API_KEY} >> ./crowdin.yaml
51-
52-
# Deploy docs
53-
./etc/docs.sh
54-
55-
fi
56-
5723
# If we're on a pull request, build the PR
5824
if ! [[ $TRAVIS_PULL_REQUEST = false ]]; then
5925

etc/docs.sh

Lines changed: 0 additions & 129 deletions
This file was deleted.

etc/home.html

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<link rel="stylesheet" href="_static/basic.css" type="text/css" />
77
<link rel="stylesheet" href="_static/sponge.css" type="text/css" />
8-
<link href='//fonts.googleapis.com/css?family=Roboto:400italic,700italic,700,400' rel='stylesheet' type='text/css' />
8+
<link href="https://fonts.googleapis.com/css?family=Roboto:400italic,700italic,700,400|Montserrat:400,700" rel="stylesheet" type="text/css" />
99
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.1/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
1010

1111
<script src="_static/jquery.js"></script>
@@ -33,19 +33,21 @@
3333
<div role="navigation" aria-label="related navigation">
3434
<div class="sp-logo-container sp-not-mobileview sp-mobileview">
3535
<a class="sp-logo-link" data-auto-route="true" href="/">
36-
<img height="40px" id="site-logo" class="logo-big" alt="Sponge Forums" src="_static/spongelogo.png">
36+
<img height="40px" id="site-logo" class="logo-big" alt="" src="https://www.spongepowered.org/assets/img/icons/spongie-mark.svg">
37+
<span id="sp-site-title">Sponge</span>
3738
</a>
3839
<div class="sp-logo-bg"></div>
3940
<div class="sp-logo-chevron"><i class="fa fa-fw fa-chevron-down"></i></div>
4041
<div class="sp-logo-menu sp-skip-handler">
4142
<ul class="sp-logo-dropdown" id="ddleft">
4243
<a href="https://www.spongepowered.org"><li><i class="fa-fw fa fa-home"></i>Homepage</li></a>
43-
<a href="https://forums.spongepowered.org"><li><i class="fa-fw fa fa-comment"></i>Forums</li></a>
44+
<a href="https://forums.spongepowered.org"><li><i class="fa-fw fa fa-comments"></i>Forums</li></a>
4445
<a href="https://github.com/SpongePowered"><li><i class="fa-fw fa fa-code"></i>Code</li></a>
45-
<a class="sp-forums-home" href="https://docs.spongepowered.org"><li class="active"><i class="fa-fw fa fa-book"></i>SpongeDocs</li></a>
46-
<a href="https://jd.spongepowered.org"><li><i class="fa-fw fa fa-graduation-cap"></i>JavaDocs</li></a>
46+
<a class="sp-forums-home" href="https://docs.spongepowered.org"><li class="active"><i class="fa-fw fa fa-book"></i>Docs</li></a>
47+
<a href="https://jd.spongepowered.org"><li><i class="fa-fw fa fa-graduation-cap"></i>Javadocs</li></a>
4748
<a href="https://forums.spongepowered.org/c/plugins/plugin-releases"><li><i class="fa-fw fa fa-plug"></i>Plugins</li></a>
48-
<a href="https://forums.spongepowered.org/t/sponge-downloads/11448"><li><i class="fa-fw fa fa-download"></i>Get Sponge</li></a>
49+
<a href="https://www.spongepowered.org/downloads"><li><i class="fa-fw fa fa-download"></i>Downloads</li></a>
50+
<a href="https://www.spongepowered.org/chat"><li><i class="fa-fw fa fa-comment"></i>Chat</li></a>
4951
</ul>
5052
</div>
5153
</div>

etc/home.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,16 @@
1111
def get_lang(lang):
1212
return [l for l in langs_list if l['crowdin_code'] == lang][0]
1313

14-
langs_args = sorted(sys.argv[1].split(',') + ['en_US'])
15-
used_langs = [get_lang(langs_mapper[lang]) for lang in langs_args]
16-
17-
#get list of current deployed releases including 'master'
1814
def listdirs(folder):
1915
return [d for d in os.listdir(folder) if os.path.isdir(os.path.join(folder, d))]
2016

21-
# get list of versions
22-
vers_list = (listdirs("deploy/"))
17+
langs_args = sorted(listdirs("locale/") + ['en_US'])
18+
used_langs = [get_lang(langs_mapper[lang]) for lang in langs_args]
19+
20+
#get list of current deployed releases excluding 'master'
21+
vers_list = [os.path.basename(b) for b in os.getenv('BRANCHES').split(' ') if b != "master"]
2322
list.sort(vers_list, reverse=True)
24-
#remove unwanted dirs from list as we don't need them
25-
vers_list.remove("master")
26-
vers_list.remove(".git")
27-
vers_list.remove("_static")
28-
# result: verslist = ['2.1.0','3.0.0','master']
23+
# result: verslist = ['2.1.0','3.0.0']
2924

3025
newlist = []
3126
# step 1: create a dictionary out of the list for every list item

etc/menubar.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,17 @@
1212
def get_lang(lang):
1313
return [l for l in langs_list if l['crowdin_code'] == lang][0]
1414

15-
langs_args = sorted(sys.argv[1].split(',') + ['en_US'])
16-
used_langs = [get_lang(langs_mapper[lang]) for lang in langs_args]
1715

18-
#get list of current deployed releases including 'master'
1916
def listdirs(folder):
2017
return [d for d in os.listdir(folder) if os.path.isdir(os.path.join(folder, d))]
2118

22-
# get list of versions
23-
vers_list = (listdirs("deploy/"))
19+
langs_args = sorted(listdirs("locale/") + ['en_US'])
20+
used_langs = [get_lang(langs_mapper[lang]) for lang in langs_args]
21+
22+
#get list of current deployed releases excluding 'master'
23+
vers_list = [os.path.basename(b) for b in os.getenv('BRANCHES').split(' ') if b != "master"]
2424
list.sort(vers_list, reverse=True)
25-
# remove unwanted dirs from list as we don't need them
26-
vers_list.remove("master")
27-
vers_list.remove(".git")
28-
vers_list.remove("_static")
29-
# result: verslist = ['2.1.0','3.0.0','master']
25+
# result: verslist = ['2.1.0','3.0.0']
3026

3127
newlist = []
3228
# step 1: create a dictionary out of the list for every list item
@@ -37,7 +33,7 @@ def listdirs(folder):
3733
# result: newlist = [{'apiversion': '3.0.0'},{'apiversion': '2.1.0'},{'apiversion': 'master'}]
3834

3935
# get the current branch
40-
v = os.getenv('BRANCHNAME')
36+
v = os.getenv('VERSION')
4137

4238
curverdict = {'currentversion': v}
4339
curverlist = []

etc/sphinx_opts.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import os
2+
import json
3+
4+
# list of languages:
5+
with open('langs.json', 'r') as f:
6+
langs = {lang['locale'].replace('-', '_'): lang["crowdin_code"] for lang in json.load(f)}
7+
8+
def listdirs(folder):
9+
return [d for d in os.listdir(folder) if os.path.isdir(os.path.join(folder, d))]
10+
11+
version = os.getenv('VERSION')
12+
13+
for locale in listdirs("locale/"):
14+
print("-D language={} source dist/{}/{}".format(locale, version, langs[locale]))

0 commit comments

Comments
 (0)