File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11name : publish
2- run-name : " ${{ format('v {0}', inputs.version ) }}"
2+ run-name : " ${{ format('release {0}', inputs.bump ) }}"
33
44on :
55 workflow_dispatch :
Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22
3- # Parse command line arguments
4- minor=false
5- while [ " $# " -gt 0 ]; do
6- case " $1 " in
7- --minor) minor=true; shift 1;;
8- * ) echo " Unknown parameter: $1 " ; exit 1;;
9- esac
10- done
11-
12- # Get the latest release from GitHub
13- latest_tag=$( gh release list --limit 1 --json tagName --jq ' .[0].tagName' )
14-
15- # If there is no tag, exit the script
16- if [ -z " $latest_tag " ]; then
17- echo " No tags found"
18- exit 1
19- fi
20-
21- echo " Latest tag: $latest_tag "
22-
23- # Remove the 'v' prefix and split into major, minor, and patch numbers
24- version_without_v=${latest_tag# v}
25- IFS=' .' read -ra VERSION <<< " $version_without_v"
26-
27- if [ " $minor " = true ]; then
28- # Increment the minor version and reset patch to 0
29- minor_number=${VERSION[1]}
30- let " minor_number++"
31- new_version=" ${VERSION[0]} .$minor_number .0"
32- else
33- # Increment the patch version
34- patch_number=${VERSION[2]}
35- let " patch_number++"
36- new_version=" ${VERSION[0]} .${VERSION[1]} .$patch_number "
37- fi
38-
39- echo " New version: $new_version "
40-
41- gh workflow run publish.yml -f version=" $new_version "
42-
3+ gh workflow run publish.yml -f bump=" patch"
You can’t perform that action at this time.
0 commit comments