Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 22 additions & 25 deletions .github/workflows/demo.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
on: [push]
on:
workflow_dispatch:
inputs:
release:
description: "Release name. String"
default: "atlas-osb beta" #TODO autogen mb?
required: true
version: #(major: -M, minor: -m, patch: -p)
description: "Version key(-Mmp).Major.minor.patch,e.g. -M/-m/-p/-mp/etc"
default: "-p"
required: true
draft:
description: "Draft (release only). Boolean"
default: "true"
required: true
postfix:
description: "Add Posfix"
required: false

jobs:
test-increment-semver-job:
Expand All @@ -10,29 +27,9 @@ jobs:
- name: Checkout
uses: actions/checkout@v1


# Examples
- name: Increment Step Patch
id: increment-semver-patch
uses: Benbentwo/increment-semver@master
with:
version-level: '-p'

- name: Increment Step Minor
id: increment-semver-minor
uses: Benbentwo/increment-semver@master
id: semver
uses: leo-ri/increment-semver@master
with:
version-level: '-m'

- name: Increment Step Major
id: increment-semver-major
uses: Benbentwo/increment-semver@master
with:
version-level: '-M'

# Use the output from the `Increment Step X` step
- name: Get the output version
run: |
echo "The new patch version was ${{ steps.increment-semver-patch.outputs.version }}"
echo "The new minor version was ${{ steps.increment-semver-minor.outputs.version }}"
echo "The new Major version was ${{ steps.increment-semver-major.outputs.version }}"
vlevel: ${{ github.event.inputs.version }}
postfix: ${{ github.event.inputs.postfix }}
37 changes: 0 additions & 37 deletions .github/workflows/main.yml

This file was deleted.

11 changes: 9 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,22 @@ branding:
color: 'gray-dark'
author: Benbentwo
inputs:
version-level: # id of input
vlevel: # id of input
description: 'Version Level to update [-Mmp]'
required: true
default: '-p'
postfix:
description: 'Add postfix'
required: false
default: 'beta'
outputs:
version: # id of output
description: 'The incremented version'
preversion:
description: 'If postfix exits - it is preversion'
runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.version-level }}
- ${{ inputs.vlevel }}
- ${{ inputs.postfix }}
18 changes: 14 additions & 4 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ shift $(($OPTIND - 1))
#version=$1
echo "cd to github workspace"
cd ${GITHUB_WORKSPACE}
git version
git for-each-ref refs/tags/ --count=1 --sort=-version:refname --format='%(refname:short)'

version=$(git for-each-ref refs/tags/ --count=1 --sort=-version:refname --format='%(refname:short)')
Expand All @@ -29,8 +30,8 @@ then
exit 1
fi
# Build array from version string.

a=( ${version//./ } )
ba=( ${version//-/ } ) #base version+postfix
a=( ${ba//./ } )
major_version=0
# If version string is missing or has the wrong number of members, show usage message.

Expand Down Expand Up @@ -72,8 +73,17 @@ then
fi

echo "${a[0]}.${a[1]}.${a[2]}"
version=$(echo "${a[0]}.${a[1]}.${a[2]}")

if [[ ! -z "$INPUT_POSTFIX" ]]; then
echo "POSTFIX is $INPUT_POSTFIX"
version=$(echo "${a[0]}.${a[1]}.${a[2]}-$INPUT_POSTFIX")
preversion=true
else
version=$(echo "${a[0]}.${a[1]}.${a[2]}")
preversion=false
fi
just_numbers=$(echo "${major_version}.${a[1]}.${a[2]}")
echo "Result version $version (preversion: $preversion)"
echo "::set-output name=version::${version}"
echo "::set-output name=stripped-version::${just_numbers}"

echo "::set-output name=preversion::${version}"