bobheadxi / deployments

🔖 GitHub Action for working painlessly with deployment statuses
https://github.com/marketplace/actions/github-deployments
MIT License
385 stars 64 forks source link

feat: add multiple deployment #72

Closed maxgfr closed 2 years ago

maxgfr commented 2 years ago

Hi @bobheadxi,

I hope, you're well, I reopen this PR #61 with a clean git history.

Sorry again for that.

bobheadxi commented 2 years ago

Sorry for the delay in review, this was a very difficult one to wrap my head around. Upon a closer look I am convinced this is not appropriate for the deployments action. This action is designed to manage the lifecycle of a single environment. I realize now you are overloading environment into not just an array, but a JSON array with URLs and everything.

What you should do instead is to use a GitHub Actions matrix to run this action multiple times:

strategy:
  matrix:
    env: [10, 12, 14]
steps:
    - name: start deployment ${{ matrix.env }}
      uses: bobheadxi/deployments
      id: deployment
      with:
        step: start
        token: ${{ secrets.GITHUB_TOKEN }}
        env: ${{ matrix.env }}
        ref: ${{ github.head_ref }}

and so on. See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix for more details.

I would love to accept a PR for a docs update that demonstrates using an environment matrix to achieve what you are trying to do here. I am also happy to answer any questions and make implementation work necessary to achieve the matrix approach. I have also pushed some changes to your branch that do a bit of cleanup, to demonstrate how you can improve your code a bit in the future 😄

Thank you for your time and attempted contribution @maxgfr !