Skip to content

Commit

Permalink
Add: release tag toml
Browse files Browse the repository at this point in the history
Adds function to automatically add release labels based on a
configuration.
  • Loading branch information
nichtsfrei committed Mar 18, 2024
1 parent 3da335c commit 84f72c8
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 5 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/auto_label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Labeler

on:
pull_request:

permissions:
pull-requests: write
contents: read

jobs:
conventional-commits:
name: Add release labels
runs-on: ubuntu-latest
steps:
- name: Report Conventional Commits
uses: nichtsfrei/actions/pr-conventional-commit-labeler@v3
with:
token: ${{ github.token }}
configuration_toml: release_tag.toml

8 changes: 3 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ jobs:
with:
token: ${{ secrets.token }}
fetch-depth: '0'

- name: set git credentials
run: |
git config --global user.email "${{ secrets.email }}"
Expand All @@ -77,15 +78,13 @@ jobs:
git checkout "v${{ env.LATEST_VERSION }}"
# get just the major version of latest version
export BRANCH_NAME=$(echo "${{ env.LATEST_VERSION }}" | sed 's/^\([0-9]*\).*/v\1/')
git checkout -b "$BRANCH_NAME"
git push origin "$BRANCH_NAME"
git checkout -b "$BRANCH_NAME" && git push origin "$BRANCH_NAME" || true
# create branch of version
- uses: greenbone/actions/setup-pontos@v3
- name: prepare project version ${{ env.RELEASE_REF }} ${{ env.LATEST_VERSION }} -> ${{ env.NEW_VERSION }}
run: |
# jump back for the case that we switched to a tag
git checkout "${{ env.RELEASE_REF }}"
# change version
python3 -m pip install pontos
# ignore failure on setting version
pontos-version update ${{ env.NEW_VERSION }} || true
# set app version on chart
Expand All @@ -107,7 +106,6 @@ jobs:
with:
name: rs-binaries
path: assets
- uses: greenbone/actions/setup-pontos@v3
- name: release ${{ env.PROJECT }} ${{ env.LATEST_VERSION }} -> ${{ env.NEW_VERSION }}
run: |
pontos-changelog \
Expand Down
22 changes: 22 additions & 0 deletions release_tag.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# the name functions as a key and should be unique.
# The priority is used when only_highest_priority is set to true
labels = [
{ name = "patch_release", priority = 1 },
{ name = "minor_release", priority = 2 },
{ name = "major_release", priority = 3 },
]

# group within groups must be defined in `changelog.toml`
# label within groups must be defined in `labels`
groups = [
{ group = "Added", label = "minor_release" },
{ group = "Changed", label = "major_release" }, # maybe minor?
{ group = "Removed", label = "major_release" }, # maybe minor?
{ group = "Bug Fixes", label = "patch_reelase" },
]

# when set to false all unique labels will be set
# otherwise only one label with the highest priority
# will be set
only_highest_priority = true

0 comments on commit 84f72c8

Please sign in to comment.