Skip to content
Open
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
90 changes: 90 additions & 0 deletions .github/workflows/component-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Component Release

permissions:
contents: write

on:
workflow_dispatch:
inputs:
tag:
description: 'Tag version to release (e.g. 1.2.3)'
required: true
type: string
workflow_call:
inputs:
tag:
description: 'Tag version to release (e.g. 1.2.3)'
required: true
type: string
secrets:
RDKCM_DEPLOY_KEY:
description: 'SSH deploy key for git operations'
required: true

jobs:
release:
if: github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call'
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
ssh-key: ${{ secrets.RDKCM_DEPLOY_KEY }}

Comment on lines +30 to +35
- name: Set up Git
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "187267378+rdkcm-rdke@users.noreply.github.com"

- name: Install git-flow and auto-changelog
run: |
sudo apt-get update
sudo apt-get install -y git-flow
npm install -g auto-changelog

- name: Configure and start release
run: |
set -e
git fetch --all
git checkout main || git checkout -b main origin/main
git checkout develop || git checkout -b develop origin/develop

git config gitflow.branch.master main
git config gitflow.branch.develop develop
git config gitflow.prefix.feature feature/
git config gitflow.prefix.bugfix bugfix/
git config gitflow.prefix.release release/
git config gitflow.prefix.hotfix hotfix/
git config gitflow.prefix.support support/
git config gitflow.prefix.versiontag ''

echo "git config completed"
RELEASE_VERSION="${{ inputs.tag }}"
echo "Using manually inputted version: $RELEASE_VERSION"
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
# Check if tag already exists
if git rev-parse "refs/tags/$RELEASE_VERSION" >/dev/null 2>&1; then
echo "Tag $RELEASE_VERSION already exists. Skipping release."
exit 0
fi
git flow release start $RELEASE_VERSION
auto-changelog -v $RELEASE_VERSION
git add CHANGELOG.md
git commit -m "$RELEASE_VERSION release changelog updates"
git flow release publish
Comment on lines +72 to +76

- name: Finish release and push (default git-flow messages)
run: |
set -e
git flow release finish -m "$RELEASE_VERSION release" $RELEASE_VERSION
git push origin main
git push origin --tags
git push origin develop

- name: Cleanup tag if workflow fails
if: failure()
run: |
git tag -d $RELEASE_VERSION || true
git push origin :refs/tags/$RELEASE_VERSION || true
Comment on lines +89 to +90