mbudisic commited on
Commit
4f10d85
·
1 Parent(s): d4304e7

feat: Add versioning and GitHub Actions workflow for automatic tagging

Browse files

- Introduced a new `version.py` file to manage the project version.
- Updated `README.md` to include a badge displaying the latest version.
- Created a GitHub Actions workflow to automatically tag the repository on changes to `version.py`, enhancing version control and deployment processes.

Files changed (3) hide show
  1. .github/workflows/tag-on-version.yml +39 -0
  2. README.md +2 -0
  3. version.py +1 -0
.github/workflows/tag-on-version.yml ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Tag on version.py change
2
+
3
+ on:
4
+ push:
5
+ paths:
6
+ - 'version.py'
7
+ branches:
8
+ - main
9
+
10
+ jobs:
11
+ tag_version:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - name: Checkout code
15
+ uses: actions/checkout@v4
16
+
17
+ - name: Extract version from version.py
18
+ id: get_version
19
+ run: |
20
+ VERSION=$(python3 -c "exec(open('version.py').read()); print(__version__)")
21
+ echo "VERSION=$VERSION" >> $GITHUB_ENV
22
+
23
+ - name: Check if tag exists
24
+ id: check_tag
25
+ run: |
26
+ if git rev-parse "v$VERSION" >/dev/null 2>&1; then
27
+ echo "Tag v$VERSION already exists."
28
+ echo "EXISTS=true" >> $GITHUB_ENV
29
+ else
30
+ echo "EXISTS=false" >> $GITHUB_ENV
31
+ fi
32
+
33
+ - name: Create and push tag
34
+ if: env.EXISTS == 'false'
35
+ run: |
36
+ git config user.name "github-actions[bot]"
37
+ git config user.email "github-actions[bot]@users.noreply.github.com"
38
+ git tag v$VERSION
39
+ git push origin v$VERSION
README.md CHANGED
@@ -9,6 +9,8 @@ license: mit
9
  short_description: Agentic RAG that interrogates the PsTuts dataset.
10
  ---
11
 
 
 
12
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
13
 
14
  # 🤖 PsTuts RAG System
 
9
  short_description: Agentic RAG that interrogates the PsTuts dataset.
10
  ---
11
 
12
+ ![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/mbudisic/PsTuts-RAG?label=version&sort=semver)
13
+
14
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
15
 
16
  # 🤖 PsTuts RAG System
version.py ADDED
@@ -0,0 +1 @@
 
 
1
+ __version__ = "1.0.0"