planningcenter / pco-release-action

Github Actions for streamlining the release process for apps that use Github releases
0 stars 0 forks source link

feat(deploy): add support for merge auto-deploys #6

Closed kylemellander closed 1 month ago

kylemellander commented 1 month ago

For prereleases, we want to be able to push updates to either staging (for rc's) or a protonova build (for qa releases). We don't want to go through the hassle of PR's for those, so this PR opens the interface of the action to allow it specify a change-method and branch-name. If change-method is set to merge, then the changes will be merged directly into the branch that is set by branch-name.

An example usage might look like this:

name: Publish

jobs:
  publish-to-npm: ...

  auto-deploy-prerelease:
    needs: publish-to-npm
    runs-on: ubuntu-latest
    steps:
      - name: Build branch name (staging if rc, use PR number and library name if qa) 
        run: |
          tag_name=${{ github.event.release.tag_name }}
          if [[ $VERSION =~ -rc\. ]]; then
            echo "branch_name=staging" >> $GITHUB_ENV
          else
            [[ $tag_name =~ -qa-([0-9]+)\. ]]
            branch_name="proto/my-library-${BASH_REMATCH[1]}"
            echo "branch_name=$branch_name" >> $GITHUB_ENV
          fi
      - uses: planningcenter/pco-release-action/deploy@v1
        if: 'github.event.release.prerelease'
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          change-method: 'merge'
          branch-name: ${{ env.branch_name }}