Skip to content

Commit 8b8fffe

Browse files
committed
adding workflows
1 parent c057875 commit 8b8fffe

File tree

3 files changed

+85
-0
lines changed

3 files changed

+85
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: C++ Formatting Check
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
cpp_formatter:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout code
10+
uses: actions/checkout@v4
11+
12+
- name: Clang Formatter
13+
uses: DoozyX/[email protected]
14+
with:
15+
clangFormatVersion: 14
16+
source: "."
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Create Release
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
jobs:
8+
create_release:
9+
if: startsWith(github.event.head_commit.message, 'new version')
10+
11+
runs-on: ubuntu-latest
12+
13+
permissions:
14+
contents: write
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Extract version from commit message
23+
run: |
24+
# Get the version from the commit message using a regex
25+
if [[ "${{ github.event.head_commit.message }}" =~ new\ version\ ([0-9]+\.[0-9]+\.[0-9]+) ]]; then
26+
echo "version=${BASH_REMATCH[1]}" >> $GITHUB_ENV
27+
else
28+
echo "Commit message does not match 'new version *.*.*' format."
29+
exit 1
30+
fi
31+
32+
- name: Get previous tag
33+
run: |
34+
previous_tag=$(git describe --tags --abbrev=0 HEAD^)
35+
echo "previous_tag=$previous_tag" >> $GITHUB_ENV
36+
37+
- name: Generate release notes with commit messages
38+
run: |
39+
commits=$(git log "${{ env.previous_tag }}..HEAD" --oneline)
40+
echo "release_body<<EOF" >> $GITHUB_ENV
41+
echo "### Changelog from version ${{ env.previous_tag }} to ${{ env.version }}:" >> $GITHUB_ENV
42+
echo "$commits" >> $GITHUB_ENV
43+
echo "EOF" >> $GITHUB_ENV
44+
45+
- name: Create GitHub release
46+
uses: actions/create-release@latest
47+
env:
48+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49+
with:
50+
tag_name: "${{ env.version }}"
51+
release_name: "${{ env.version }}"
52+
body: "${{ env.release_body }}"
53+
draft: false
54+
prerelease: false
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Python Formatting Check
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
python_formatter:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout code
10+
uses: actions/checkout@v4
11+
12+
- name: Black Formatter
13+
uses: lgeiger/black-action@master
14+
with:
15+
args: ". --check --diff --line-length 90"

0 commit comments

Comments
 (0)