Skip to content

Commit

Permalink
Merge pull request #19 from meysamhadeli/feat/add-realese-drafter
Browse files Browse the repository at this point in the history
feat: Add release drafter
  • Loading branch information
meysamhadeli authored Jan 12, 2023
2 parents 531fa46 + 80a1d0e commit ffcf6b4
Show file tree
Hide file tree
Showing 6 changed files with 250 additions and 0 deletions.
99 changes: 99 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# https://johanneskonings.dev/github/2021/02/28/github_automatic_releases_and-changelog/
# https://tiagomichaelsousa.dev/articles/stop-writing-your-changelogs-manually
# https://github.com/release-drafter/release-drafter/issues/551
# https://github.com/release-drafter/release-drafter/pull/1013
# https://github.com/release-drafter/release-drafter/issues/139
# https://github.com/atk4/data/blob/develop/.github/release-drafter.yml

# This release drafter follows the conventions from https://keepachangelog.com, https://common-changelog.org/
# https://www.conventionalcommits.org

name-template: 'v$RESOLVED_VERSION'
tag-template: 'v$RESOLVED_VERSION'
template: |
## What Changed 👀
$CHANGES
**Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION
categories:
- title: 🚀 Features
labels:
- feature
- title: 🐛 Bug Fixes
labels:
- fix
- bug
- title: ♻️ Changes
labels:
- changed
- enhancement
- refactor
- title: ⛔️ Deprecated
labels:
- deprecated
- title: 🗑 Removed
labels:
- removed
- title: 🔐 Security
labels:
- security
- title: 📄 Documentation
labels:
- docs
- documentation
- title: 🧩 Dependency Updates
labels:
- deps
- dependencies
- title: 🧰 Maintenance
label: 'chore'
- title: 🧺 Miscellaneous #Everything except ABAP
label: misc
- title: 📝 Other changes
## putting no labels pr to `Other Changes` category with no label - https://github.com/release-drafter/release-drafter/issues/139#issuecomment-480473934

# https://www.trywilco.com/post/wilco-ci-cd-github-heroku
# https://github.com/release-drafter/release-drafter#autolabeler
# https://github.com/fuxingloh/multi-labeler

# Using regex for defining rules - https://regexr.com/ - https://regex101.com/
autolabeler:
- label: 'chore'
branch:
- '/(chore)\/.*/'
title:
- '/^chore: .*/'
- label: 'docs'
branch:
- '/(docs)\/.*/'
title:
- '/^docs: .*/'
- label: 'bug'
branch:
- '/(fix)\/.*/'
title:
- '/^fix: .*/'
- label: 'feature'
branch:
- '/(feat)\/.*/'
title:
- '/^feat: .*/'
body:
- '/JIRA-[0-9]{1,4}/'

change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
version-resolver:
major:
labels:
- major
minor:
labels:
- minor
patch:
labels:
- patch
default: patch

exclude-labels:
- skip-changelog
47 changes: 47 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes
# https://github.com/bcoe/conventional-release-labels
# https://dev.to/github/how-to-automatically-generate-release-notes-for-your-project-2ng8
# https://www.conventionalcommits.org/en/v1.0.0/

# github release pre-defined template
changelog:
exclude:
labels:
- ignore-for-release
categories:
- title: 🚀 Features
labels:
- feature
- title: 🐛 Bug Fixes
labels:
- fix
- bug
- title: ♻️ Changes
labels:
- changed
- enhancement
- refactor
- title: ⛔️ Deprecated
labels:
- deprecated
- title: 🗑 Removed
labels:
- removed
- title: 🔐 Security
labels:
- security
- title: 📄 Documentation
labels:
- docs
- documentation
- title: 🧩 Dependency Updates
labels:
- deps
- dependencies
- title: 🧰 Maintenance
label: 'chore'
- title: 🧺 Miscellaneous #Everything except ABAP
label: misc
- title: Other Changes
labels:
- "*"
33 changes: 33 additions & 0 deletions .github/workflows/checker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# https://github.com/amannn/action-semantic-pull-request
# https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/configuring-commit-squashing-for-pull-requests

name: Conventional Commits Checks

on:
workflow_run:
workflows: ["Release Drafter Auto Labeler"]
types:
- completed

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true

jobs:

check-conventional-commits-labels:
name: Check conventional commits labels
runs-on: [ self-hosted ]
steps:
- uses: danielchabr/pr-labels-checker@v3.1
with:
hasSome: feature,fix,changed,deprecated,removed,security,docs,dependencies
githubToken: ${{ secrets.GITHUB_TOKEN }}

validate-pull-request-title:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21 changes: 21 additions & 0 deletions .github/workflows/release-drafter-labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Release Drafter Auto Labeler

on:
pull_request:
types:
- opened
- synchronize
- reopened
- labeled
- unlabeled

jobs:
auto-labeler:
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v5
with:
config-name: release-drafter.yml
disable-releaser: true # only run auto-labeler for PRs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20 changes: 20 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# https://johanneskonings.dev/github/2021/02/28/github_automatic_releases_and-changelog/
# https://tiagomichaelsousa.dev/articles/stop-writing-your-changelogs-manually
name: Release Drafter

on:
push:
branches:
- develop
- main

jobs:
update_release_draft:
name: Release drafter
runs-on: ubuntu-latest

steps:
- name: Update Release Draft
uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30 changes: 30 additions & 0 deletions .github/workflows/update-changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
on:
release:
types:
- released
push:
branches:
- main

# Every push to main will create a new release and deploy to production.
jobs:
update:
name: Update Changelog
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Update Changelog
uses: stefanzweifel/changelog-updater-action@v1
with:
latest-version: ${{ github.event.release.name }}
release-notes: ${{ github.event.release.body }}

- name: Commit updated Changelog
uses: stefanzweifel/git-auto-commit-action@v4
with:
branch: main
commit_message: 'docs(changelog): update changelog'
file_pattern: CHANGELOG.md

0 comments on commit ffcf6b4

Please sign in to comment.