Commit 16100055 authored by Ruben ten Hove's avatar Ruben ten Hove
Browse files

Merge branch 'rhtenhove-beta-patch-72130' into 'beta'

feat: auto add assets to .releaserc

See merge request just-ci/templates!50
parents 9b25952d 625657fd
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ semantic-release:
  stage: .post
  variables:
    EXTRA_ARGS: ""
    DISABLE_AUTO_FIX_ASSETS: "false"
  script:
    - |
      if ! test -f ".releaserc"; then
@@ -20,7 +21,14 @@ semantic-release:
      if jq -e '.plugins[3][1].assets[0]' .releaserc >/dev/null 2>&1 && [ ! -z ${BUMPED_FILES} ]; then
        for FILE in ${BUMPED_FILES}; do
          if ! jq -e --arg FILE "$FILE" '.plugins[3][1].assets | index($FILE)' .releaserc > /dev/null; then
            echo "[!] '${FILE}' has changed, but isn't listed in the assets in '.releaserc'. Ensure it is matched, else the version bumped files will not be pushed to your repo."
            printf "[!] '${FILE}' has changed, but isn't listed in the assets in '.releaserc'. "
            if [ "${DISABLE_AUTO_FIX_ASSETS}" = "true" ];
              echo "Ensure it is matched, else the version bumped files will not be pushed to your repo."
            else
              echo "It will be added for you."
              jq -e --arg FILE "$FILE" '.plugins[3][1].assets |= . + [$FILE]' .releaserc > .releaserc.tmp
              mv .releaserc.tmp .releaserc
            fi
          fi
        done
      fi