From 9e62ce7e07bd272696c52725c8dc97a0af34e683 Mon Sep 17 00:00:00 2001 From: Sami KACHAI Date: Tue, 17 Dec 2024 15:11:21 +0100 Subject: [PATCH] ci(release): update workflow (#52) --- .github/workflows/release.yaml | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 3618b52..cd323f0 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -18,6 +18,14 @@ jobs: with: fetch-depth: 0 + - name: Create and checkout update-changelog + run: | + BRANCH_NAME="update-changelog" + + git checkout -b $BRANCH_NAME + + git push -u origin $BRANCH_NAME + - name: Set up Node.js uses: actions/setup-node@v4 with: @@ -38,11 +46,6 @@ jobs: - name: Update changelog file if: ${{ startsWith(github.ref, 'refs/tags/v') }} run: | - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" - git fetch origin main - git checkout -b update-changelog origin/main - yarn commitizen init cz-conventional-changelog --save-dev --force --save-exact HEADER=$(awk '/^---/{exit} {print}' CHANGELOG.md) yarn conventional-changelog -p angular -o TEMP.md -r 0 @@ -51,10 +54,6 @@ jobs: cat TEMP.md >> CHANGELOG.md rm TEMP.md - echo "Updated CHANGELOG.md:" - cat CHANGELOG.md - git diff || echo "No changes detected" - - name: Fetch initial commit history id: fetch_initial_commit_history run: | @@ -87,7 +86,10 @@ jobs: - name: Commit changelog changes run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" git add CHANGELOG.md + git restore --source=HEAD --worktree . git commit -m "chore: update changelog for ${{ github.ref }}" git push -u origin update-changelog --force