Skip to content

Commit

Permalink
chore/MSSDK-2108: automated releases github workflows configuration (#…
Browse files Browse the repository at this point in the history
…463)

* chore/MSSDK-2108: automated releases github workflows configuration

* chore/MSSDK-2108: polish the workflow configuration files
  • Loading branch information
Saddage authored Feb 19, 2025
1 parent e1910fa commit af3a3dd
Show file tree
Hide file tree
Showing 7 changed files with 189 additions and 17 deletions.
26 changes: 26 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
breaking:
- head-branch: ['breaking/*', 'breaking-change/*']

fix:
- head-branch: ['fix/*']

feat:
- head-branch: ['feat/*']

chore:
- head-branch: ['chore/*']

docs:
- head-branch: ['docs/*']

refactor:
- head-branch: ['refactor/*']

style:
- head-branch: ['style/*']

test:
- head-branch: ['test/*']

release:
- head-branch: ['release/*']
52 changes: 52 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name-template: '$RESOLVED_VERSION'
tag-template: '$RESOLVED_VERSION'
categories:
- title: 'Breaking changes'
labels:
- 'breaking'
- 'breaking-change'
- title: 'New features'
labels:
- 'feat'
- title: 'Fixes'
labels:
- 'fix'
- title: 'Improvements & Maintenance'
labels:
- 'chore'
- 'docs'
- 'refactor'
- 'style'
- 'test'
version-resolver:
major:
labels:
- 'breaking'
- 'breaking-change'
minor:
labels:
- 'feat'
- 'fix'
patch:
labels:
- 'chore'
- 'docs'
- 'refactor'
- 'style'
- 'test'
default: patch
replacers:
- search: '/(breaking|breaking-change|feat|fix|chore|docs|refactor|style|test)\/MSSDK-\d+:\s*/'
replace: ''
change-template: '- $TITLE ([#$NUMBER]($URL)) by @$AUTHOR'
sort-by: 'title'
template: |
# What's Changed
$CHANGES
**Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION
exclude-labels:
- 'skip-changelog'
- 'release'
44 changes: 44 additions & 0 deletions .github/workflows/finalize-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Publish library to NPM registry and synchronize branches

on:
release:
types: [published]
permissions:
contents: read
defaults:
run:
shell: bash

env:
GIT_AUTHOR_NAME: github-actions[bot]
GIT_AUTHOR_EMAIL: github-actions[bot]@users.noreply.github.com
GIT_COMMITTER_NAME: github-actions[bot]
GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com

jobs:
publish:
uses: ./.github/workflows/call-publish.yml
permissions:
contents: read
packages: write
with:
access: public
registry: registry.npmjs.org
secrets:
TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

merge_main_to_develop:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Merge main into develop
run: |
git fetch origin develop
git fetch origin main
git checkout develop
git merge origin/main
git push origin develop
12 changes: 12 additions & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: 'Pull request labeler'
on:
- pull_request_target

jobs:
labeler:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v5
17 changes: 0 additions & 17 deletions .github/workflows/on-release.yml

This file was deleted.

36 changes: 36 additions & 0 deletions .github/workflows/release-candidate-pull-request-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Release candidate Pull Request check

on:
pull_request:
types: [opened, synchronize, reopened, edited]
branches:
- main

defaults:
run:
shell: bash

jobs:
process_release:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
packages: write
outputs:
version: ${{ steps.extract_version.outputs.version }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Check branch name and extract version
id: extract_version
run: |
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
if ! [[ $BRANCH_NAME =~ ^(release|hotfix)/([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then
echo "Error: Branch name must be release/x.y.z or hotfix/x.y.z" && exit 1
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
19 changes: 19 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Generate a release draft

on:
push:
branches:
- main
permissions:
contents: read

jobs:
generate_release_draft:
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ github.token }}

0 comments on commit af3a3dd

Please sign in to comment.