Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b0672d7fde | ||
| fa21264ef3 | |||
|
|
eb59f30b38 | ||
| 455a3b4115 | |||
| c9f03b4f1f | |||
|
|
2cbd5835a0 | ||
| ef82a4c4ca | |||
| 3a1e58bb8d | |||
| ae0109050d | |||
| 0ced6ea4e7 | |||
| c3e9b3c634 | |||
| 9f916356a0 | |||
| 075402803f | |||
| 048feaba33 |
@@ -19,6 +19,19 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
fetch-tags: true
|
fetch-tags: true
|
||||||
|
- name: Install uv
|
||||||
|
uses: astral-sh/setup-uv@v5
|
||||||
|
- name: Set up Python
|
||||||
|
run: uv python install
|
||||||
|
with:
|
||||||
|
python-version-file: "pyproject.toml"
|
||||||
|
- name: Install the project dependencies
|
||||||
|
run: |
|
||||||
|
uv sync --all-groups
|
||||||
|
uv add pip
|
||||||
|
uv export --format requirements.txt -o requirements.txt
|
||||||
|
# uv run python -m pip install --upgrade pip
|
||||||
|
# uv run python -m pip install -r requirements.txt
|
||||||
|
|
||||||
- name: Derive lowercase repo name
|
- name: Derive lowercase repo name
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -18,39 +18,12 @@ on:
|
|||||||
- "major"
|
- "major"
|
||||||
- "minor"
|
- "minor"
|
||||||
- "patch"
|
- "patch"
|
||||||
pull_request:
|
|
||||||
types: [closed]
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
# Only run on merged PRs with [release-*] or manual workflow_dispatch
|
|
||||||
if: |
|
|
||||||
github.event_name == 'workflow_dispatch' ||
|
|
||||||
(github.event_name == 'pull_request' && github.event.pull_request.merged == true && contains(github.event.pull_request.title, '[release-'))
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Determine bump type
|
|
||||||
id: bump_type
|
|
||||||
run: |
|
|
||||||
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
|
|
||||||
echo "type=${{ github.event.inputs.bump }}" >> $GITHUB_OUTPUT
|
|
||||||
else
|
|
||||||
# Extract bump type from PR title: [release-patch], [release-minor], [release-major]
|
|
||||||
PR_TITLE="${{ github.event.pull_request.title }}"
|
|
||||||
if [[ "$PR_TITLE" =~ \[release-major\] ]]; then
|
|
||||||
echo "type=major" >> $GITHUB_OUTPUT
|
|
||||||
elif [[ "$PR_TITLE" =~ \[release-minor\] ]]; then
|
|
||||||
echo "type=minor" >> $GITHUB_OUTPUT
|
|
||||||
elif [[ "$PR_TITLE" =~ \[release-patch\] ]]; then
|
|
||||||
echo "type=patch" >> $GITHUB_OUTPUT
|
|
||||||
else
|
|
||||||
echo "type=patch" >> $GITHUB_OUTPUT
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4.2.2
|
uses: actions/checkout@v4.2.2
|
||||||
with:
|
with:
|
||||||
@@ -79,7 +52,7 @@ jobs:
|
|||||||
id: bump
|
id: bump
|
||||||
run: |
|
run: |
|
||||||
uv tool install bump-my-version
|
uv tool install bump-my-version
|
||||||
uv tool run bump-my-version bump ${{ steps.bump_type.outputs.type }}
|
uv tool run bump-my-version bump ${{ github.event.inputs.bump }}
|
||||||
# echo the version to github env, the version is shown by using uv tool run bump-my-version show current_version
|
# echo the version to github env, the version is shown by using uv tool run bump-my-version show current_version
|
||||||
echo "VERSION<<EOF" >> $GITHUB_ENV
|
echo "VERSION<<EOF" >> $GITHUB_ENV
|
||||||
echo "$(uv tool run bump-my-version show current_version)" >> $GITHUB_ENV
|
echo "$(uv tool run bump-my-version show current_version)" >> $GITHUB_ENV
|
||||||
@@ -104,12 +77,12 @@ jobs:
|
|||||||
echo "tag=$prev" >> "$GITHUB_OUTPUT"
|
echo "tag=$prev" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
- name: Compute lowercased image repo
|
- name: Compute lowercased image repo
|
||||||
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.docker_release == 'true' || github.event_name == 'pull_request' }}
|
if: ${{ github.event.inputs.docker_release == 'true' }}
|
||||||
run: |
|
run: |
|
||||||
echo "IMAGE_REPO=${{ secrets.REGISTRY }}/$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
|
echo "IMAGE_REPO=${{ secrets.REGISTRY }}/$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Docker meta
|
- name: Docker meta
|
||||||
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.docker_release == 'true' || github.event_name == 'pull_request' }}
|
if: ${{ github.event.inputs.docker_release == 'true' }}
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v5
|
||||||
with:
|
with:
|
||||||
@@ -119,13 +92,12 @@ jobs:
|
|||||||
type=raw,value=${{ env.VERSION }}
|
type=raw,value=${{ env.VERSION }}
|
||||||
|
|
||||||
- name: Build and push Docker image
|
- name: Build and push Docker image
|
||||||
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.docker_release == 'true' || github.event_name == 'pull_request' }}
|
if: ${{ github.event.inputs.docker_release == 'true' }}
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
platforms: linux/amd64
|
platforms: linux/amd64
|
||||||
push: true
|
push: true
|
||||||
no-cache: true
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
|
||||||
@@ -146,7 +118,7 @@ jobs:
|
|||||||
GITHUB_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||||
|
|
||||||
- name: Create Gitea Release
|
- name: Create Gitea Release
|
||||||
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.github_release == 'true' || github.event_name == 'pull_request' }}
|
if: ${{ github.event.inputs.github_release == 'true' }}
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v1
|
||||||
with:
|
with:
|
||||||
tag_name: v${{ env.VERSION }}
|
tag_name: v${{ env.VERSION }}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "semapform"
|
name = "semapform"
|
||||||
version = "0.1.2"
|
version = "0.2.2"
|
||||||
description = "Add your description here"
|
description = "Add your description here"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.13"
|
requires-python = ">=3.13"
|
||||||
@@ -15,7 +15,7 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[tool.bumpversion]
|
[tool.bumpversion]
|
||||||
current_version = "0.1.2"
|
current_version = "0.2.2"
|
||||||
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
|
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
|
||||||
serialize = ["{major}.{minor}.{patch}"]
|
serialize = ["{major}.{minor}.{patch}"]
|
||||||
search = "{current_version}"
|
search = "{current_version}"
|
||||||
|
|||||||
Reference in New Issue
Block a user