shellglobal-variablestravis-cifile-readtravis-ci-cli

.travis.yml file should read from another file a value and use it


In my .travis.yml file I wanna read which issues is the latest at the moment in my issue file

.travis.yml:

env:
  global:
    - issues=$(cat "issues.txt");
matrix:
  include:
  - language: bash
    script:
    - bash linux_mac/magpi-issue-downloader.sh -f $issues-4 -l $issues

issues file:
issue file: only a 89 is in

as you see, I wanna run the bash script with something like:

- bash linux_mac/magpi-issue-downloader.sh -f 85 -l 89

Travis shows in the console that there is no error, but it was not doing it correctly as you can see in the screenshot
.travis screenshot

The .travis.yml is in the same root folder as the issues.txt file
folder screenshot


Solution

  • I fixed it now like this:

    env:
      global:
        - issue=$(<issues.txt)
    matrix:
      include:
      - language: bash
        script:
        - bash linux_mac/magpi-issue-downloader.sh -f $(($issue - 5)) -l $(($issue))
    

    this worked for me.