Skip to content

RightBrain-Networks/semver-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Release Version Self Version & Release

semver-action

Github Action for RBN Auto Semver by Branch tool

Usage

Runs to either set or get the semantic version managed by auto-semver.

Inputs

mode

Accepted values: get, set

Default: set

set mode

Outputs

RETURN_STATUS

The exit code of semver. Returns 0 on new version.

See the exit codes section on auto-semver README.

SEMVER_NEW_VERSION

The version pulled from the .bumpversion.cfg file after being updated

VERSION

The version outputed by semver.

Example

In this example, auto-semver runs on master and creates a release on a new version:

name: Version & Release

on:
  push:
    branches:
      - master

jobs:
  CheckVersion:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout
      uses: actions/checkout@v1
    - name: Run Auto-Semver
      id: semver
      uses: RightBrain-Networks/[email protected]
      with:
        mode: set
    - name: Create Release
      uses: actions/create-release@v1
      if: steps['semver']['outputs']['RETURN_STATUS'] == '0'
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      with:
        tag_name: ${{ steps.semver.outputs.SEMVER_NEW_VERSION }}
        release_name: ${{ steps.semver.outputs.SEMVER_NEW_VERSION }}
        body: Version ${{ steps.semver.outputs.SEMVER_NEW_VERSION }} released automatically by [RightBrain-Networks/auto-semver](https://github.com/RightBrain-Networks/auto-semver)
        draft: false
        prerelease: false

get mode

This mode grabs the version from the ref and updates any files listed in .bumpversion.cfg

Therefore, to get the proper version the trigger should be a release or a push to tags.

Outputs

VERSION

The semantic version found in the ref

Example

In this example, the version is updated from the ref to build a python package.

name: Build Python Package
on:
  release:
    types:
    - created

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1
    - name: Set up Python 3.7
      uses: actions/setup-python@v1
      with:
        python-version: 3.7
    - name: Run Auto-Semver
      id: semver
      uses: RightBrain-Networks/[email protected]
      with:
        mode: set
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install -r requirements.txt
    - name: build
      run: |
        python setup.py sdist bdist_wheel

About

Github Action for RBN Auto Semver by Branch tool

Resources

License

Stars

Watchers

Forks

Packages

No packages published