Skip to content

Commit

Permalink
feat: release on specific labels
Browse files Browse the repository at this point in the history
Related to github/github-ospo#105

Only generate a release and new action container images
if our semver related labels (`breaking`, `enhancement`) 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] manually add `vuln` and `release` labels to repository

Signed-off-by: jmeridth <[email protected]>
  • Loading branch information
jmeridth committed Apr 28, 2024
1 parent 696df8e commit aabd0b3
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ name: Release

on:
workflow_dispatch:
push:
pull_request:
types:
- closed
branches:
- main

Expand All @@ -12,6 +14,11 @@ permissions:

jobs:
create_release:
if: |
github.event.pull_request.merged == true &&
(contains(github.event.pull_request.labels.*.name, 'breaking') ||
contains(github.event.pull_request.labels.*.name, 'enhancement') ||
contains(github.event.pull_request.labels.*.name, 'release'))
outputs:
full-tag: ${{ steps.release-drafter.outputs.tag_name }}
short-tag: ${{ steps.get_tag_name.outputs.SHORT_TAG }}
Expand All @@ -34,6 +41,7 @@ jobs:
short_tag=$(echo ${{ steps.release-drafter.outputs.tag_name }} | cut -d. -f1)
echo "SHORT_TAG=$short_tag" >> $GITHUB_OUTPUT
create_action_images:
if: github.event.pull_request.merged == true
needs: create_release
runs-on: ubuntu-latest
permissions:
Expand Down Expand Up @@ -66,6 +74,7 @@ jobs:
provenance: false
sbom: false
create_discussion:
if: github.event.pull_request.merged == true
needs: create_release
runs-on: ubuntu-latest
permissions:
Expand Down

0 comments on commit aabd0b3

Please sign in to comment.