From c37ede9202f7bf8539fc6fac72dbf0e215675ae9 Mon Sep 17 00:00:00 2001 From: enrique Date: Thu, 14 Mar 2024 14:50:46 +0100 Subject: [PATCH] feat: update release action --- .github/workflows/release-github.yml | 36 ++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release-github.yml b/.github/workflows/release-github.yml index 719266f..ccfe7dd 100644 --- a/.github/workflows/release-github.yml +++ b/.github/workflows/release-github.yml @@ -19,7 +19,10 @@ jobs: # Build process - uses: actions/setup-node@v3 with: - node-version: "14.x" + node-version: '18' + + - name: Set version to env + run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV - name: Update CHANGELOG.md id: changelog @@ -27,13 +30,36 @@ jobs: npm install auto-changelog npx auto-changelog + - name: Detect branch to commit changelog + id: branch-changelog + run: | + tagged_branches=$(git --no-pager branch -a --contains tags/${{ env.RELEASE_VERSION }} --no-column) + echo "$tagged_branches" + if echo "$tagged_branches" | grep -E '^[[:space:]]*main$' > /dev/null; then + commit_branch=main + elif echo "$tagged_branches" | grep -E '^[[:space:]]*master$' > /dev/null; then + commit_branch=master + elif echo "$tagged_branches" | grep -E '^[[:space:]]*develop$' > /dev/null; then + commit_branch=develop + else + commit_branch=$(echo "$tagged_branches" | tail -n1) + commit_branch=${commit_branch//[[:blank:]]/} + fi + commit_branch="${commit_branch//remotes\/origin\//}" + echo "COMMIT_BRANCH=${commit_branch}" >> $GITHUB_ENV + - name: Commit CHANGELOG.md uses: stefanzweifel/git-auto-commit-action@v4 with: commit_message: Automated CHANGELOG.md update - commit_options: "--no-verify --signoff" + commit_options: '--no-verify --signoff' file_pattern: CHANGELOG.md - branch: main + branch: ${{ env.COMMIT_BRANCH }} - - name: Publish Github Release - uses: softprops/action-gh-release@v1 \ No newline at end of file + - name: Publish Github relase + uses: 'marvinpinto/action-automatic-releases@latest' + with: + repo_token: '${{ secrets.GITHUB_TOKEN }}' + prerelease: false + files: | + CHANGELOG.md \ No newline at end of file