Skip to content

Python Auto Version Tag

Actions
Automatically generate new tags when version file changes
draft
Latest
Star (4)

Python Container Action Template

This action will read a python version file and compare the version variable to the project's known tags. If a corresponding tag does not exist, it will be created.

Usage

The following is an example .github/workflows/main.yml that will execute when a push to the master branch occurs.

Example workflow

name: Python 🐍 Auto Version Tag

on:
  push:
    branches: [master]

jobs:
  tag:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - name: Version tag
        uses: samamorgan/action-autotag-python@master

        with:
          path: package/__version__.py
          variable: __version__
          github_token: ${{ secrets.GITHUB_TOKEN }}
          prefix: v

Inputs

Input Description
path Path to version file
variable Variable name containing version information
prefix (optional) Prefix to add to the version tag
suffix (optional) Suffix to add to the version tag

Configuration

The GITHUB_TOKEN must be passed in. Without this, it is not possible to create a new tag. Make sure the autotag action looks like the following example:

- uses: samamorgan/action-autotag-python@master
  with:
    path: package/__version__.py
    variable: __version__
    github_token: ${{ secrets.GITHUB_TOKEN }}

The action will automatically extract the token at runtime. DO NOT MANUALLY ENTER YOUR TOKEN. If you put the actual token in your workflow file, you'll make it accessible (in plaintext) to anyone who ever views the repository (it will be in your git history).

Python Auto Version Tag is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

Automatically generate new tags when version file changes
draft
Latest

Python Auto Version Tag is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.