Skip to main content

Simple, opinionated semantic versioning package.

Project description

pagekey-semver

This is a simple, opinionated semantic versioning tool.

Check out the docs site (coming soon) or the docs site source to learn more.

Getting Started

  1. Install the package
pip install pagekey-semver
  1. Run the dry run to see what will happen.
pagekey-semver plan
  1. Run it for real to tag and push!
pagekey-semver apply

Usage

As you'll see below, it's highly recommended to set the SEMVER_TOKEN variable to your push credential, as well as SEMVER_USER if applicable for your Git hosting platform.

GitHub Actions

The simplest way to get started is to paste the following workflow into a file such as .github/workflows/ci.yml.

name: Run semantic version process.

on: [push]

jobs:
  version:
    uses: pagekey/semver/.github/workflows/semver.yml@main

If you want to specify which user is used to push, you can use the following snippet. You must create the SEMVER_USER and SEMVER_TOKEN secrets. You can use a GitHub Personal Access Token set as a repo or organization secret. If you'd rather not use your personal account for the PAT, you can use a bot account.

name: Run semantic version process.

on: [push]

jobs:
  version:
    uses: pagekey/semver/.github/workflows/semver.yml@main
    with:
      SEMVER_USER: ${{ secrets.SEMVER_USER }}
      SEMVER_TOKEN: ${{ secrets.SEMVER_TOKEN }}

Beware that GitHub does not trigger a pipeline on tags pushed from Actions (or at least, I couldn't figure out how to get it to do that.)

If you want to trigger another workflow only when a tag has been created, you can use the following, combining needs and if to check:

jobs:
  # ...
  # omitting inclusion of semver.yml shown above
  # ...

  publish:
    needs: version
    if: ${{ needs.version.outputs.semver_release_occurred == 'true' }}
    steps:
      # Do anything that should only occur on new tags, such as publishing/deploying your code.
      - name: Checkout code
        uses: actions/checkout@v4

GitLab CI/CD

GitLab CI/CD is a bit more straightforward than GitHub Actions for this package. There is no restriction on running pipelines that have been created automatically, so a tag pipeline will run when the package pushes. Use the following snippet in your .gitlab-ci.yml file to get started. Be sure to set SEMVER_USER and SEMVER_TOKEN. For user, you can use oauth2, gitlab-ci-token, or your username. For the token, use a personal or group access token.

Note that only and except are deprecated, but are included here for simplicity. You can migrate to rules if you would like.

stages:
  - version


semver-dry-run:
  stage: version
  image: python:3.10
  except: [main, tags]
  script:
    - pip install pagekey-semver
    - pagekey-semver plan

semver:
  stage: version
  image: python:3.10
  only: [main]
  script:
    - pip install pagekey-semver
    - pagekey-semver apply

Philosophy

This is an opinionated version of Semantic Release that loosely follows the guidelines at semver.org. It puts practicality above all theory. There is no special treatment of "pre-releases", versions prior to v1.0.0. Everything behaves the same: patch prefixes increment the third number, minor patches increment the middle number, and major prefixes increment the first number. If there are multiple prefixes, the prefix with the greatest precedence is applied. If you don't like the default settings, you can override them using the configuration format below.

This package is intended to run on a Linux system with the bash shell installed.

Configuration

See here for more information on how to configure the tool.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pagekey_semver-0.3.25.tar.gz (15.9 kB view details)

Uploaded Source

Built Distribution

pagekey_semver-0.3.25-py3-none-any.whl (22.3 kB view details)

Uploaded Python 3

File details

Details for the file pagekey_semver-0.3.25.tar.gz.

File metadata

  • Download URL: pagekey_semver-0.3.25.tar.gz
  • Upload date:
  • Size: 15.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.12 Linux/6.5.0-1025-azure

File hashes

Hashes for pagekey_semver-0.3.25.tar.gz
Algorithm Hash digest
SHA256 39184c51e0038f1960c15c342d7e4aa9d1a8978857b7b2e49fd810d632926a19
MD5 6fb090697493edf8d46d0e0a992408c5
BLAKE2b-256 6753243c49f0a79cec5f7763332c464cb415fa6d7f49acb9560f83fa28575638

See more details on using hashes here.

File details

Details for the file pagekey_semver-0.3.25-py3-none-any.whl.

File metadata

  • Download URL: pagekey_semver-0.3.25-py3-none-any.whl
  • Upload date:
  • Size: 22.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.12 Linux/6.5.0-1025-azure

File hashes

Hashes for pagekey_semver-0.3.25-py3-none-any.whl
Algorithm Hash digest
SHA256 b958b46a580a5b70e7b4b9e480508ec067547baaeb33a2e77e902f3937b9d0d3
MD5 6ea9ba10864960a75c207d9274169b97
BLAKE2b-256 baa67de83ee31d0b69b1f935934532afb4a3c16c01417dd0865357b7b8ed6a51

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page