Skip to content

Commit da8528d

Browse files
committed
feature: Use composite action
1 parent fa06788 commit da8528d

File tree

1 file changed

+35
-19
lines changed

1 file changed

+35
-19
lines changed

action.yml

Lines changed: 35 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ branding:
55
icon: 'git-branch'
66
color: 'gray-dark'
77
inputs:
8+
tool-version:
9+
description: 'The version of the tool to be ran'
10+
required: true
11+
default: latest
812
release-branch:
913
description: 'The name of the release branch'
1014
required: true
@@ -23,27 +27,39 @@ inputs:
2327
outputs:
2428
version:
2529
description: 'The value of the new pre-calculated tag'
30+
value: ${{ steps.version.outputs.version }}
2631
previous-version:
2732
description: 'Contains the value of previous tag, before calculating a new one'
33+
value: ${{ steps.previous-version.outputs.version }}
2834
runs:
29-
using: 'docker'
30-
image: 'Dockerfile'
31-
args:
32-
- /bin/bash
33-
- -c
34-
- |
35-
VERSION=$(/bin/git-version \
36-
--release-branch "${{ inputs.release-branch }}" \
37-
--dev-branch "${{ inputs.dev-branch }}" \
38-
--version-prefix "${{ inputs.prefix }}") && \
39-
echo "::set-output name=version::$VERSION" && \
35+
using: "composite"
36+
steps:
37+
- id: previous-version
38+
shell: bash
39+
run: |
40+
set -e
41+
42+
export PREVIOUS_VERSION=$(docker run -v $(pwd):/repo codacy/git-version:${{ inputs.tool-version }} \
43+
/bin/git-version \
44+
--previous-version \
45+
--folder /repo \
46+
--release-branch "${{ inputs.release-branch }}" \
47+
--dev-branch "${{ inputs.dev-branch }}" \
48+
--version-prefix "${{ inputs.prefix }}")
49+
50+
echo "::set-output name=previous-version::$PREVIOUS_VERSION"
51+
echo "Previous Version: $PREVIOUS_VERSION"
52+
- id: version
53+
shell: bash
54+
run: |
55+
set -e
4056
41-
PREVIOUS_VERSION=$(/bin/git-version \
42-
--previous-version \
43-
--release-branch "${{ inputs.release-branch }}" \
44-
--dev-branch "${{ inputs.dev-branch }}" \
45-
--version-prefix "${{ inputs.prefix }}") && \
46-
echo "::set-output name=previous-version::$PREVIOUS_VERSION" && \
57+
export VERSION=$(docker run -v $(pwd):/repo codacy/git-version:${{ inputs.tool-version }} \
58+
/bin/git-version \
59+
--folder /repo \
60+
--release-branch "${{ inputs.release-branch }}" \
61+
--dev-branch "${{ inputs.dev-branch }}" \
62+
--version-prefix "${{ inputs.prefix }}")
4763
48-
echo "Previous Version: $PREVIOUS_VERSION"
49-
echo "New Version: $VERSION"
64+
echo "::set-output name=version::$VERSION"
65+
echo "New Version: $VERSION"

0 commit comments

Comments
 (0)