Add major-minor-release workflow

This commit is contained in:
s-weigand 2020-11-03 15:55:55 +01:00
parent 54b39fb937
commit e34653ec97
2 changed files with 50 additions and 0 deletions

View File

@ -0,0 +1,17 @@
import sys
from packaging.version import parse
print(sys.version_info)
tag_ref = sys.argv[1]
tag_name = tag_ref.split("/")[-1]
print(f"tag_name: {tag_name}")
version = parse(tag_name)
print(f"version: {version}")
if not (version.is_prerelease):
print("Creating new major and minor tags!")
print(f"::set-output name=original_tag_name::{tag_name}")
print(f"::set-output name=major_version::v{version.major}")
print(f"::set-output name=minor_version::v{version.major}.{version.minor}")
else:
print("No tags created (dev or pre version)!")

View File

@ -0,0 +1,33 @@
name: "Publish Major-Minor-Tags"
on:
push:
tags:
- "v*"
jobs:
push-tags:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install packaging
run: pip install -U packaging
- name: Get versions
id: get_versions
run: python .github/workflows/publish-major-minor.py ${{ github.ref }}
- name: Push Tags Version
if: steps.get_versions.outputs.original_tag_name != ''
env:
original_tag_name: ${{ steps.get_versions.outputs.original_tag_name }}
major_version: ${{ steps.get_versions.outputs.major_version }}
minor_version: ${{ steps.get_versions.outputs.minor_version }}
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git tag -a $major_version -m "original tag: $original_tag_name"
git tag -a $minor_version -m "original tag: $original_tag_name"
git push origin $major_version -f
git push origin $minor_version -f