Skip to content

Release

Release #7

Workflow file for this run

# Create an incremental tag on Github using SemVer https://semver.org: x.y.z
name: Release
on:
workflow_dispatch:
inputs:
choice:
type: choice
description: "Release types: x.y.patch, x.minor.z, major.y.z"
options:
- patch
- minor
- major
jobs:
release:
# if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
name: Tag for release
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Last version
id: last-version
run: echo "tag=$(git describe --tags `git rev-list --tags --max-count=1`)" >> $GITHUB_ENV
- name: debug
run: echo ${{ steps.last-version.outputs.tag }}
- name: Bump version
id: bump-version
uses: olegsu/semver-action@v1
with:
version: ${{ steps.last-version.outputs.tag }}
bump: ${{ inputs.choice }}
- name: Create tag as version for the package on Packagist.org
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "GitHub Actions"
git tag ${{ steps.bump-version.outputs.version }}
git push origin ${{ steps.bump-version.outputs.version }}