thefrontside / ctrlc-windows

Send a CTRL-C event to a Windows console application
9 stars 2 forks source link

Run release workflow on the condition that git tag does not exist #9

Closed minkimcello closed 4 years ago

minkimcello commented 4 years ago

Motivation

I thought doing if: github.actor == github-actions would ensure that the release workflow will trigger only when we merge a changeset PR but unfortunately the github actor is based on who merges the PR (which makes sense because the person doing the merge is "creating" a commit on the head branch).

Approach

Instead of relying on the github actor, I added a higher level job to check git tags.

The job will take the current package version and check to see if corresponding git tags exist and the remaining release workflow will only resume if no tags are returned. This ensures that the release workflow will run only when a package version is bumped (either manually or via changeset PR).

I added a patch changeset to trigger a new PR so I can merge that one too to test the full workflow. And I will manually create a fake release of 0.1.2 (current package version) so that the merge of THIS pull request does not go through the release cycle.

changeset-bot[bot] commented 4 years ago

🦋 Changeset detected

Latest commit: 84e2f1678f3d56983f8d92408a96f3b68e2e3903

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | ------------- | ----- | | ctrlc-windows | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

minkimcello commented 4 years ago

👍