Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Automatic Draft Release Creator; Reusable Workflow #52

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/release-drafter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Release Drafter

on:
workflow_call:
secrets:
GITHUB_TOKEN:
description: 'Token'
required: true

jobs:
update-release-draft:
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
commitish: main

# See: https://github.com/release-drafter/release-drafter
40 changes: 39 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,41 @@
# engineering-github-actions

Repository to store reusable workflows for github actions
Repository to store reusable workflows for github actions

## Workflows

### [release-drafter.yml](./.github/workflows/release-drafter.yml)

This workflow can be used to create a release draft based on the PRs since the last release. It will also create a changelog based on the PRs merged.

To use:

1. Create a `.github/workflows/release-drafter.yml` file in your repository
```yaml
name: Release Drafter
on:
push:
branches:
- main
pull_request:
types:
- opened
- reopened
- synchronize
- edited
permissions:
contents: read
jobs:
release-draft:
permissions:
pull-requests: write
contents: write
uses: >-
coopnorge/engineering-github-actions/.github/workflows/release-drafter.yaml@main
secrets: inherit
```

2. **OPTIONAL:** Create a `.github/release-drafter.yml` file in your repository.
Copy the [default configuration](https://github.com/coopnorge/.github/blob/main/.github/release-drafter.yml) and modify it to your needs.

** NOTE: ** Although it is possible to have different format for release drafts. It is recommended to use the default format to ensure consistency across repositories. If you have any suggestion on how the release should look like please open an issue.
14 changes: 14 additions & 0 deletions catalog-info.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: engineering-github-action-release-drafter
title: Create draft releases from pull requests
description: |
Create draft releases from pull requests
annotations:
github.com/project-slug: coopnorge/engineering-github-action
backstage.io/techdocs-ref: dir:.
spec:
type: library
lifecycle: experimental
owner: engineering
64 changes: 64 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Github workflow to create a release draft based on the PRs since the last release (release-drafter.yaml)

This workflow will create a release draft based on the PRs merged since the last release. It will also create a changelog based on the PRs merged.

This workflow will also try to assign labels to PR based on the title of the PR. The labels is defined [here](https://github.com/coopnorge/.github/blob/main/.github/release-drafter.yml)

## Usage

1. Create a `.github/workflows/release-drafter.yml` file in your repository
```yaml
name: Release Drafter
on:
push:
branches:
- main
pull_request:
types:
- opened
- reopened
- synchronize
- edited
permissions:
contents: read
jobs:
release-draft:
permissions:
pull-requests: write
contents: write
uses: >-
coopnorge/engineering-github-actions/.github/workflows/release-drafter.yaml@main
secrets: inherit
```

2. **OPTIONAL:** Create a `.github/release-drafter.yml` file in your repository.
Copy the [default configuration](https://github.com/coopnorge/.github/blob/main/.github/release-drafter.yml) and modify it to your needs.

** NOTE: ** Although it is possible to have different format for release drafts. It is recommended to use the default format to ensure consistency across repositories. If you have any suggestion on how the release should look like please open an issue.

## How it works

When a PR is created, this workflow will check the PR title and try to assign labels to the PR based on the title. If you do not agree with the labels assigned you can assign new labels yourself.

Supported labels for version bumping:

```
- "patch" # bump 0.0.X
- "minor" # bump 0.X.0
- "major" # bump X.0.0
```

Supported labels to help with changelog grouping:

```
- "dependency"
- "chore"
- "enhancements"
- "bug-fix"
- "deprecation"
- "breaking-change"
```

After you have merged the PR, the draft release will be created/updated. The draft release will be based on the PRs merged since the last release. The draft release will also contain a changelog based on the PRs merged.

When you are ready to release, you can publish the release draft. This will create a new release and tag the release with the version number.
Loading