Skip to content

Commit

Permalink
new workflow to create releases
Browse files Browse the repository at this point in the history
  • Loading branch information
mgonzs13 committed Nov 28, 2024
1 parent d0294ea commit a729e44
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
49 changes: 49 additions & 0 deletions .github/workflows/create_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Create Release

on:
push:
branches: [main]

jobs:
create_release:
if: startsWith(github.event.head_commit.message, 'new version')
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Extract version from commit message
run: |
# Get the version from the commit message using a regex
if [[ "${{ github.event.head_commit.message }}" =~ new\ version\ ([0-9]+\.[0-9]+\.[0-9]+) ]]; then
echo "version=${BASH_REMATCH[1]}" >> $GITHUB_ENV
else
echo "Commit message does not match 'new version *.*.*' format."
exit 1
fi
- name: Get previous tag
run: |
previous_tag=$(git describe --tags --abbrev=0 HEAD^)
echo "previous_tag=$previous_tag" >> $GITHUB_ENV
- name: Generate release notes with commit messages
run: |
commits=$(git log "${{ env.previous_tag }}..HEAD" --oneline)
echo "release_body<<EOF" >> $GITHUB_ENV
echo "### Changelog from version ${{ env.previous_tag }} to ${{ env.version }}:" >> $GITHUB_ENV
echo "$commits" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Create GitHub release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.LLAMA_ROS_GITHUB_TOKEN }}
with:
tag_name: "${{ env.version }}"
release_name: "${{ env.version }}"
body: "${{ env.release_body }}"
draft: false
prerelease: false
2 changes: 1 addition & 1 deletion .github/workflows/doxygen-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ jobs:
- name: Deploy Doxygen page
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.DOXYGEN_DEPLOY_TOKEN }}
github_token: ${{ secrets.LLAMA_ROS_GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: docs/html

0 comments on commit a729e44

Please sign in to comment.