Skip to content

Commit 3b43a9c

Browse files
committed
feat: release on specific labels
Related to github/github-ospo#105 Only generate a release and new action container images if our semver related labels (`breaking`, `enhancement`, `fix`) or the `release` label are used on a merged pull request. Changed from push (merge) on main branch to release generation happening when a pull_request is merged to main branch. This gives us access to the pull requests labels without having to make API cals. Currently we'd still need to label a pull request with `release` if it is a dependabot or manual pull request related to a CVE or security fix. - [x] update CONTRIBUTING.md with new release information - [x] manually add `vuln` and `release` labels to repository Signed-off-by: jmeridth <[email protected]>
1 parent 2248559 commit 3b43a9c

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

.github/release-drafter.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ version-resolver:
3535
minor:
3636
labels:
3737
- 'enhancement'
38+
- 'fix'
3839
patch:
3940
labels:
40-
- 'fix'
4141
- 'documentation'
4242
- 'maintenance'
4343
default: patch

.github/workflows/release.yml

+13-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33

44
on:
55
workflow_dispatch:
6-
push:
6+
pull_request:
7+
types:
8+
- closed
79
branches:
810
- main
911

@@ -12,6 +14,16 @@
1214

1315
jobs:
1416
create_release:
17+
# release if
18+
# manual deployment OR
19+
# merged to main and labelled with release labels
20+
if: |
21+
(github.event_name == 'workflow_dispatch') ||
22+
(github.event.pull_request.merged == true &&
23+
(contains(github.event.pull_request.labels.*.name, 'breaking') ||
24+
contains(github.event.pull_request.labels.*.name, 'enhancement') ||
25+
contains(github.event.pull_request.labels.*.name, 'vuln') ||
26+
contains(github.event.pull_request.labels.*.name, 'release')))
1527
outputs:
1628
full-tag: ${{ steps.release-drafter.outputs.tag_name }}
1729
short-tag: ${{ steps.get_tag_name.outputs.SHORT_TAG }}

CONTRIBUTING.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,6 @@ We are using [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.
7878

7979
## Releases
8080

81-
Releases are automated but if you need to manually initiate a release you can do so through the GitHub Actions UI. If you have permissions to do so, you can navigate to the [Actions tab](https://github.com/github/contributors/actions/workflows/release.yml) and select the `Run workflow` button. This will allow you to select the branch to release from and the version to release.
81+
Releases are automated if a pull request is labelled with our [semver related labels](.github/release-drafter.yml) or with the `vuln` or `release` labels.
82+
83+
You can also manually initiate a release you can do so through the GitHub Actions UI. If you have permissions to do so, you can navigate to the [Actions tab](https://github.com/github/contributors/actions/workflows/release.yml) and select the `Run workflow` button. This will allow you to select the branch to release from and the version to release.

0 commit comments

Comments
 (0)