This repository contains GitHub Actions workflows
This workflow extracts the version number from the specified Python package directory and creates a new Git tag if it does not already exist.
.github/workflows/version-tag-workflow.yaml
The workflow is designed to be reusable using workflow_call. It accepts the following input:
| Name | Description | Required | Type | Default |
|---|---|---|---|---|
| package_path | Path to the package directory containing __init__.py |
✅ | string | my_repo_name |
The workflow requires contents: write permission to create and push tags.
This workflow can be used in another repository as follows:
name: Version Tag Creator
on:
push:
paths:
- 'my_repo/__init__.py'
branches:
- 'develop'
jobs:
call-version-tag-workflow:
uses: Centura-AG/centura_workflows/.github/workflows/version-tag-workflow.yaml@develop
permissions:
contents: write
with:
package_path: ${{ github.event.repository.name }}name: Version Tag Creator
on:
push:
tags:
- 'v*'
jobs:
call-version-tag-workflow:
uses: Centura-AG/centura_workflows/.github/workflows/create-version-based-on-tag.yaml
permissions:
contents: write
with:
package_path: ${{ github.event.repository.name }}
pushed_tag: ${{ github.ref_name }}
- The target repository must contain a Python package with an
__init__.pyfile where__version__is defined. - The workflow should be triggered when a relevant change is made to the
__init__.pyfile. - Ensure
contents: writepermission is granted to allow tag creation.
This project is licensed under the MIT License. You are free to use, modify, and distribute it. However, it comes without any warranty or liability. Use it at your own risk.