Skip to content

Commit

Permalink
feat: update release action
Browse files Browse the repository at this point in the history
  • Loading branch information
eruizgar91 committed Mar 14, 2024
1 parent d312da5 commit c37ede9
Showing 1 changed file with 31 additions and 5 deletions.
36 changes: 31 additions & 5 deletions .github/workflows/release-github.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,47 @@ 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
run: |
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
- name: Publish Github relase
uses: 'marvinpinto/action-automatic-releases@latest'
with:
repo_token: '${{ secrets.GITHUB_TOKEN }}'
prerelease: false
files: |
CHANGELOG.md

0 comments on commit c37ede9

Please sign in to comment.