Skip to content

Commit 9942c6a

Browse files
Merge pull request #308 from SpM-lab/terasaki/introduce-release-note
Introduce workflow creating release tags
2 parents 2eb23e3 + d7828c2 commit 9942c6a

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed

.github/workflows/CreateTag.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Create Tag and Release from Version Header
2+
on:
3+
push:
4+
branches: [main]
5+
6+
jobs:
7+
tag-and-release:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v4
11+
12+
- name: Extract version from header
13+
id: version
14+
run: |
15+
MAJOR=$(grep "#define SPARSEIR_VERSION_MAJOR" include/sparseir/version.h | awk '{print $3}')
16+
MINOR=$(grep "#define SPARSEIR_VERSION_MINOR" include/sparseir/version.h | awk '{print $3}')
17+
PATCH=$(grep "#define SPARSEIR_VERSION_PATCH" include/sparseir/version.h | awk '{print $3}')
18+
VERSION="v${MAJOR}.${MINOR}.${PATCH}"
19+
echo "version=$VERSION" >> $GITHUB_OUTPUT
20+
echo "Version: $VERSION"
21+
22+
# Check if remote tag exists
23+
git fetch --tags
24+
if git tag -l | grep -q "^$VERSION$"; then
25+
echo "Tag $VERSION already exists"
26+
echo "should_create=false" >> $GITHUB_OUTPUT
27+
else
28+
echo "should_create=true" >> $GITHUB_OUTPUT
29+
fi
30+
31+
- name: Create Release
32+
if: steps.version.outputs.should_create == 'true'
33+
uses: softprops/action-gh-release@v1
34+
with:
35+
tag_name: ${{ steps.version.outputs.version }}
36+
name: Release ${{ steps.version.outputs.version }}
37+
draft: false
38+
prerelease: false
39+
generate_release_notes: true
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# libsparseir
22

33
[![CMake on a single platform](https://github.com/SpM-lab/libsparseir/actions/workflows/CI_cmake.yml/badge.svg)](https://github.com/SpM-lab/libsparseir/actions/workflows/CI_cmake.yml)
4+
[![Create Tag and Release](https://github.com/SpM-lab/libsparseir/actions/workflows/CreateTag.yml/badge.svg)](https://github.com/SpM-lab/libsparseir/actions/workflows/CreateTag.yml)
45

56
> [!WARNING]
67
> This C++ project is still under construction. Please use other repositories:
@@ -18,6 +19,30 @@ This C++ library provides routines for constructing and working with the interme
1819

1920
We use [tuwien-cms/libxprec](https://github.com/tuwien-cms/libxprec) as a double-double precision arithmetic library.
2021

22+
## CI/CD
23+
24+
This project uses GitHub Actions for continuous integration and automated releases:
25+
26+
- **CI_cmake.yml**: Runs automated tests on every push and pull request to ensure code quality
27+
- **CreateTag.yml**: Automatically creates tags and releases when version numbers are updated in `include/sparseir/version.h`
28+
29+
### Automated Release Process
30+
31+
The release process is fully automated:
32+
33+
1. Update version numbers in `include/sparseir/version.h` by modifying:
34+
- `SPARSEIR_VERSION_MAJOR`
35+
- `SPARSEIR_VERSION_MINOR`
36+
- `SPARSEIR_VERSION_PATCH`
37+
38+
2. Push changes to the main branch
39+
40+
3. The GitHub Action will automatically:
41+
- Extract the version from the header file
42+
- Check if a tag with that version already exists
43+
- Create a new tag and release if the version is new
44+
- Generate release notes automatically
45+
2146
## Building and Installation
2247

2348
### Dependencies

0 commit comments

Comments
 (0)