Skip to content

Commit

Permalink
Moving KEY to ENV var
Browse files Browse the repository at this point in the history
  • Loading branch information
xavivars committed Jul 18, 2020
1 parent ae17f52 commit eed8a86
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 4 deletions.
11 changes: 11 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
stages:
- programs

libreoffice:
image: python:3.8
services:
- docker:dind
stage: programs
script: ./programs/libreoffice/libreoffice-valencia.sh
rules:
- if: '$PROGRAM == "LIBREOFFICE"'
12 changes: 12 additions & 0 deletions programs/libreoffice/Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]

[packages]
requests = "*"

[requires]
python_version = "3.8"
57 changes: 57 additions & 0 deletions programs/libreoffice/Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions programs/libreoffice/libreoffice-valencia.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,7 @@ def upload_file(project_slug, translation):
TARGET_PATH = 'translations'

# Llegim la clau d'usuari del Weblate (límit 1.000 consultes diàries)
KEY_FILE = open('key.txt', 'r')
API_KEY = KEY_FILE.readline().rstrip()
KEY_FILE.close()
API_KEY = os.environ["LIBO_WEBLATE_API_KEY"]

API_URL = "https://translations.documentfoundation.org/api/"
API_HEADERS = {'Accept': 'application/json, text/javascript',
Expand Down
4 changes: 3 additions & 1 deletion programs/libreoffice/libreoffice-valencia.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ sed -i -e "s|^:END$|s\/^\\\(\\\\\"Language-Team\\\): .*\\\\\\\n/\\\\1: $team\\\\
rm -R "translations/*"

# Cridem l'script de Python que fa la feina
./libreoffice-valencia.py
pip3 install pipenv
pipenv install requests
pipenv run python ./libreoffice-valencia.py


# Neteja
Expand Down

0 comments on commit eed8a86

Please sign in to comment.