title: GitHub Action - How to deploy release on multiple environment?
body: <p>In my case, there are four environments, Dev, QA, UAT and Prod, windows based, self-hosted runners. Once the package is build, it should be deployed to each environment one after the another in a successful manner DevQAUATPROD. Below workflow has been written to build and deploy the package only for Dev environment. Now to deploy the release on QA, UAT and Prod environment further, should the same deployment section be repeated for QA, UAT and Prod. Is there no concept like classes where the steps of deploying the release can be called multiple times with arguments?</p>
  <p><strong>Workflow-API</strong></p>
  <blockquote>
  <p><strong>Build section</strong></p>
  </blockquote>
  <pre><code>name: PASH-API-Build-Deployment 
  on: 
   push:
      branches: [dev]
      paths: 
      - &quot;Pash.Web/**&quot; 
  jobs:
   build:
      runs-on: dev-build
      strategy:
        matrix:
          node-version: 3.1.301
      env:
        api-project:  &quot;./Pash.Web/PASH.Api/PASH.Api.csproj&quot;
        test-project:  &quot;./Pash.Web/PASH.Api.Test/PASH.Api.Test.csproj&quot;
        upload-artifacts-path: &quot;./pashdotnetcorewebapp&quot;
        artifact-package-zip-directory-path: &quot;_PASH-API-CI/Pash-drop&quot;
        
      steps:
      - name: Generate build number
        id: buildnumber
        uses: einaregilsson/build-number@v3 
        with:
          token: ${{ secrets.github_token }}
      - name: Print build number - env
        run: |
         echo &quot;::set-output name=VAR-BUILD-NUMBER::${env:BUILD_NUMBER}&quot;
         echo Build Id first way = ${env:BUILD_NUMBER}
         echo Build Id second way = ${{ steps.buildnumber.outputs.build_number }}
      
      - uses: actions/checkout@v2
  
      - name: Setup .NET Core - ${{ matrix.node-version }}
        uses: actions/setup-dotnet@v1
        with:
          dotnet-version: ${{ matrix.node-version }}
  
      - name: Install dependencies
        run: dotnet restore ${{env.api-project}}
  
      - name: Build
        run: dotnet build ${{env.api-project}} --configuration Release --no-restore
  
      - name: Test
        run: dotnet test ${{env.test-project}} --no-restore --verbosity normal
  
      - name: Publish
        run: dotnet publish ${{env.api-project}} -c Release -o pashdotnetcorewebapp
  
      - name: publish artifacts
        uses: actions/upload-artifact@v2
        with:
         name: pash-api-artifact-${{ steps.buildnumber.outputs.build_number }}
         path: ${{ env.upload-artifacts-path }}
  
      - name: Store Build Number on Build Server 
        run: echo ${{ steps.buildnumber.outputs.build_number }} &gt; ${{github.workspace}}/buildnumberapi.txt
      
      - name: Publish Upload Build File 
        uses: actions/upload-artifact@v2
        with:
          name: buildnumberapi
          path: ${{github.workspace}}/buildnumberapi.txt
  </code></pre>
  <blockquote>
  <p><strong>Deploy section</strong></p>
  </blockquote>
  <pre><code>  deploy:
      needs: [build]
      runs-on: dev-deploy
  
      env:
        deploy-powershell-script:  &quot;D:\\github-deploy-ps.ps1&quot;
        stop-powershell-script:  &quot;D:\\stop-website-ps.ps1&quot;
        pool-name: &quot;PASHAPIPool&quot;
        site-name: &quot;PASHServicesAPISite&quot;
  
      steps:
      #- name: Print Build Number from BUILD job
        #run: echo ${{ needs.build.output.VAR-BUILD-NUMBER}}
  
      - name: Download Build File
        uses: actions/download-artifact@v2
        with:
          name: buildnumberapi
          path: ${{github.workspace}}
  
      - name: Print build ID
        run: |
          $varbuildnumber = cat ${{github.workspace}}/buildnumberapi.txt
          echo The result is $varbuildnumber
          echo &quot;::set-output name=var-build-number::$varbuildnumber&quot;
        id: selectbuildID
  
      - name: Download Release Artifacts
        uses: actions/download-artifact@v2
        with:
          name: pash-api-artifact-${{steps.selectbuildID.outputs.var-build-number}}
          path: ${{github.workspace}}/${{ env.artifact-package-zip-directory-path }}
   
      - name: Run Powershell commands to deploy release
        run: |
          &amp; '${{env.deploy-powershell-script}}' ${{env.pool-name}} ${{env.site-name}} ${{env.physical-path}} ${{ env.port-name}} 
  </code></pre>
  <p>Now the question is, should the same deployment section be repeated again in the same workflow for QA, UAT and Prod. This does not seem a good choice? I am new to GitHub Actions and your suggestions would be very helpful.</p>