diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index a0ca15a..6384902 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -27,14 +27,29 @@ jobs: create_release: # release if # manual deployment OR - # merged to main and labelled with release labels + # merged to main and labelled with release labels (breaking, feature, vuln) OR + # merged to main and labelled with release + a semver label (major, minor, OR patch) if: | - (github.event_name == 'workflow_dispatch') || + ( + github.event_name == 'workflow_dispatch') || (github.event.pull_request.merged == true && - (contains(github.event.pull_request.labels.*.name, 'breaking') || + ( + contains(github.event.pull_request.labels.*.name, 'breaking') || contains(github.event.pull_request.labels.*.name, 'feature') || - contains(github.event.pull_request.labels.*.name, 'vuln') || - contains(github.event.pull_request.labels.*.name, 'release'))) + contains(github.event.pull_request.labels.*.name, 'vuln') + ) || + ( + contains(github.event.pull_request.labels.*.name, 'release') && + contains(github.event.pull_request.labels.*.name, 'major') + ) || + ( + contains(github.event.pull_request.labels.*.name, 'release') && + contains(github.event.pull_request.labels.*.name, 'minor') + ) || + ( + contains(github.event.pull_request.labels.*.name, 'release') && + contains(github.event.pull_request.labels.*.name, 'patch') + )) outputs: full-tag: ${{ steps.release-drafter.outputs.tag_name }} short-tag: ${{ steps.get_tag_name.outputs.SHORT_TAG }} diff --git a/README.md b/README.md index 55d9b14..7989321 100644 --- a/README.md +++ b/README.md @@ -18,10 +18,10 @@ This is a placeholder repo for multiple GitHub Actions we use in open source pro > > [Workflows](.github/workflows) -> [!CAUTION] -> In our default `release-drafter.yaml` file and hardcoded in our `release.yaml` reusable workflow, we use the labels `major`, `minor`, and `patch` to determine the type of release to create. Unfortunately, Dependabot uses these same labels, by default, on its PRs to indicate the type of version update. This can cause unintended releases to be created when Dependabot PRs are merged. -> The "fix" is to include `labels: ["package-name", "dependencies"]` in your `dependabot.yaml` configuration file to ensure Dependabot PRs are labeled correctly and do not use the `major`, `minor`, or `patch` labels. -> You can see an example of this in the [dependabot.yaml](.github/dependabot.yaml) file in this repository. +> [!TIP] +> In order to update the semver version of a release both the `release` and a semver label (`major`, `minor`, or `patch`) must be used on the pull request that is merged to `main`. +> +> This is to prevent accidental version bumps from pull requests that are not intended to be releases. (example: Dependabot PRs that label themselves with semver labels) > [!TIP] > You can reuse the following files in this repository in your own as they are used by the reusable workflows: