From cdce0958f8caed7011c5c2815b7de5b33d255956 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Tue, 15 Nov 2022 12:39:25 +0100 Subject: [PATCH] deploy: convert .gitlab-ci.yml generation to dict + yaml.dump() --- fdroidserver/deploy.py | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/fdroidserver/deploy.py b/fdroidserver/deploy.py index 1ca90ab4..e9b30ac6 100644 --- a/fdroidserver/deploy.py +++ b/fdroidserver/deploy.py @@ -25,6 +25,7 @@ import re import subprocess import time import urllib +import yaml from argparse import ArgumentParser import logging import shutil @@ -445,16 +446,21 @@ def update_servergitmirrors(servergitmirrors, repo_section): continue if remote.name == 'gitlab': logging.debug('Writing .gitlab-ci.yml to deploy to GitLab Pages') - with open(os.path.join(git_mirror_path, ".gitlab-ci.yml"), "wt") as out_file: - out_file.write("""pages: - script: - - mkdir .public - - cp -r * .public/ - - mv .public public - artifacts: - paths: - - public -""") + with open(os.path.join(git_mirror_path, ".gitlab-ci.yml"), "wt") as fp: + yaml.dump( + { + 'pages': { + 'script': [ + 'mkdir .public', + 'cp -r * .public/', + 'mv .public public', + ], + 'artifacts': {'paths': ['public']}, + } + }, + fp, + default_flow_style=False, + ) repo.git.add(all=True) repo.index.commit("fdroidserver git-mirror: Deploy to GitLab Pages")