File tree Expand file tree Collapse file tree 5 files changed +170
-0
lines changed
Expand file tree Collapse file tree 5 files changed +170
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Build Package
2+ description : Build Python package using build
3+
4+ inputs :
5+ python-version :
6+ description : Python version to use
7+ required : true
8+ default : " 3.10"
9+
10+ runs :
11+ using : composite
12+ steps :
13+ - name : 🐍 Set up Python ${{ inputs.python-version }}
14+ uses : actions/setup-python@v5
15+ with :
16+ python-version : ${{ inputs.python-version }}
17+
18+ - name : ⚙️ Install dependencies
19+ shell : bash
20+ run : |
21+ python -m pip install --upgrade pip
22+ pip install build --no-cache-dir
23+
24+ - name : 📦 Build Package
25+ shell : bash
26+ run : python -m build
Original file line number Diff line number Diff line change 1+ name : Commit and Push
2+ description : Commit and push changes to repository
3+
4+ inputs :
5+ message :
6+ description : Commit message
7+ required : true
8+ files :
9+ description : Files to commit (space-separated)
10+ required : true
11+ branch :
12+ description : Branch to push to
13+ required : false
14+ default : " "
15+
16+ runs :
17+ using : composite
18+ steps :
19+ - name : 💾 Commit and push changes
20+ shell : bash
21+ run : |
22+ git config --local user.email "action@github.com"
23+ git config --local user.name "GitHub Action"
24+ git add ${{ inputs.files }}
25+ git commit -m "${{ inputs.message }}"
26+ if [ -z "${{ inputs.branch }}" ]; then
27+ git push
28+ else
29+ git push origin HEAD:${{ inputs.branch }}
30+ fi
Original file line number Diff line number Diff line change 1+ name : Extract Version
2+ description : Extract version from release tag
3+
4+ inputs :
5+ tag :
6+ description : Release tag name
7+ required : true
8+
9+ outputs :
10+ version :
11+ description : Extracted version without 'v' prefix
12+ value : ${{ steps.get_version.outputs.version }}
13+
14+ runs :
15+ using : composite
16+ steps :
17+ - name : 🔍 Extract version from tag
18+ id : get_version
19+ shell : bash
20+ run : |
21+ VERSION="${{ inputs.tag }}"
22+ # Remove 'v' prefix if present
23+ VERSION="${VERSION#v}"
24+ echo "version=$VERSION" >> $GITHUB_OUTPUT
25+ echo "Extracted version: $VERSION"
Original file line number Diff line number Diff line change 1+ name : Setup Poetry
2+ description : Setup Poetry with caching
3+
4+ inputs :
5+ python-version :
6+ description : Python version to use
7+ required : true
8+ poetry-version :
9+ description : Poetry version to install
10+ required : false
11+ default : latest
12+ install-deps :
13+ description : Dependencies groups to install (e.g., dev,code-quality)
14+ required : false
15+ default : " "
16+
17+ runs :
18+ using : composite
19+ steps :
20+ - name : 🐍 Set up Python ${{ inputs.python-version }}
21+ uses : actions/setup-python@v5
22+ with :
23+ python-version : ${{ inputs.python-version }}
24+ allow-prereleases : true
25+
26+ - name : 📦 Install Poetry
27+ uses : snok/install-poetry@v1
28+ with :
29+ version : ${{ inputs.poetry-version }}
30+ virtualenvs-create : true
31+ virtualenvs-in-project : true
32+
33+ - name : 💾 Cache Poetry dependencies
34+ uses : actions/cache@v4
35+ with :
36+ path : |
37+ .venv
38+ ~/.cache/pypoetry
39+ key : ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
40+ restore-keys : |
41+ ${{ runner.os }}-poetry-
42+
43+ - name : ⚙️ Install dependencies
44+ if : inputs.install-deps != ''
45+ shell : bash
46+ run : |
47+ poetry install --with ${{ inputs.install-deps }} --no-interaction --no-ansi
Original file line number Diff line number Diff line change 1+ name : Update Version
2+ description : Update version in all version files
3+
4+ inputs :
5+ version :
6+ description : Version to set
7+ required : true
8+
9+ runs :
10+ using : composite
11+ steps :
12+ - name : 📝 Update LAST_VERSION
13+ shell : bash
14+ run : |
15+ echo "${{ inputs.version }}" > LAST_VERSION
16+
17+ - name : 📝 Update pyproject.toml
18+ shell : bash
19+ run : |
20+ VERSION="${{ inputs.version }}"
21+ # Update [project] version
22+ sed -i '/^\[project\]/,/^\[/s/^version = ".*"/version = "'"$VERSION"'"/' pyproject.toml
23+ # Update [tool.poetry] version
24+ sed -i '/^\[tool\.poetry\]/,/^\[/s/^version = ".*"/version = "'"$VERSION"'"/' pyproject.toml
25+
26+ - name : 📝 Update __init__.py
27+ shell : bash
28+ run : |
29+ VERSION="${{ inputs.version }}"
30+ sed -i "s/^__version__ = \".*\"/__version__ = \"$VERSION\"/" mkdocs_simple_blog/__init__.py
31+
32+ - name : 🔍 Verify changes
33+ shell : bash
34+ run : |
35+ echo "=== LAST_VERSION ==="
36+ cat LAST_VERSION
37+ echo ""
38+ echo "=== pyproject.toml version ==="
39+ grep "^version = " pyproject.toml | head -2
40+ echo ""
41+ echo "=== __init__.py version ==="
42+ grep "^__version__ = " mkdocs_simple_blog/__init__.py
You can’t perform that action at this time.
0 commit comments