From e063a6fdb047a5bcd216ad3ffab62e11598ff159 Mon Sep 17 00:00:00 2001
From: Gilles Filippini <pini@debian.org>
Date: Sat, 7 Jan 2023 11:01:51 +0100
Subject: [PATCH] docker: push README.md on release

Add stage 'readme' and job 'readme_docker_release_tag' to push the file
'docker/README.md' to the team's duniter-v2s repo.

The job uses chko/docker-pushrm and is adapted from the related Gitlab
CI/CD example.

See https://github.com/christian-korneck/docker-pushrm
---
 .gitlab-ci.yml | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 12aa2a85b..6352c8a28 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -5,6 +5,7 @@ stages:
   - build
   - tests
   - deploy
+  - deploy_readme
 
 workflow:
   rules:
@@ -272,3 +273,21 @@ deploy_docker_release_tag:
     - docker push "duniter/duniter-v2s:latest"
   dependencies:
     - build_release
+
+readme_docker_release_tag:
+  stage: deploy_readme
+  rules:
+    - if: "$CI_COMMIT_TAG && $CI_COMMIT_TAG =~ /^v*/"
+    - when: never
+  image:
+    name: chko/docker-pushrm
+    entrypoint: ["/bin/sh", "-c", "/docker-pushrm"]
+  variables:
+    DOCKER_USER: "duniterteam"
+    DOCKER_PASS: "$DUNITERTEAM_PASSWD"
+    PUSHRM_SHORT: "Duniter v2 based on Substrate framework"
+    PUSHRM_TARGET: "docker.io/duniter/duniter-v2s"
+    PUSHRM_DEBUG: 1
+    PUSHRM_FILE: "$CI_PROJECT_DIR/docker/README.md"
+  script: "/bin/true"
+
-- 
GitLab