title: Github Actions Substitute String before Deploying
body: <p>I am trying to develop a Github Action to update the Version Number and DB credentials in my (mostly) php files before uploading to a FTP server.</p>
  <p>Inside my main branch, I have a textfile called <code>VERSION.md</code> with the content <code>2.0.1</code>.</p>
  <p>The action should run on each push commit.</p>
  <p>Before deploying to a FTP server, these substitutions are required (of course, the <em>real</em> repository files should not be changed, only the files which are uploaded to the server).</p>
  <ul>
  <li>For each file, the string <code>__VERSION__</code> should be replaced with the content of my <code>VERSION.md</code> file.</li>
  <li>In addition, only for the file <code>db_connection.php</code>, the string <code>__DB-PASSWORD__</code> should be replaced with the corresponding secret <code>DB_PASSWORD</code>.</li>
  </ul>
  <p>This is my current workflow:</p>
  <pre><code>on: push
  name: FTP Deploy
  jobs:
    web-deploy:
      name: Ubuntu VM
      runs-on: ubuntu-latest
      steps:
      - name: Getting latest Code
        uses: actions/checkout@v2.3.2
      
      # at this position I tried the string replacing
  
      - name: Sync Files
        uses: SamKirkland/FTP-Deploy-Action@4.0.0
        with:
          server: ${{ secrets.ftp_server }}
          username: ${{ secrets.ftp_username }}
          password: ${{ secrets.ftp_password }}
          server-dir: &quot;public_html/&quot;
          exclude: .git*
            - .git*/**
            - fonts/ttf/**
            - symbols/**
            - README.md
            - VERSION.md
  </code></pre>
  <p>As a first test, I have tried</p>
  <pre><code>- name: Set Tokens
        run: perl -pi -e 's/getString\(R\.string\.token\)/&quot;$ENV{TOKEN}&quot;/' 'index.php'
        env:
          TOKEN: ${{ secrets.TOKEN }}
  </code></pre>
  <p>to replace only for <code>index.php</code> the string <code>TOKEN</code> with a token stored in my secrets, but this fails. Everything looks ok, but there is no change a the server.</p>