Skip to content

Commit 60b3c3c

Browse files
robinbaxonRobin Hovind
authored andcommitted
fix: gh-86: allow flexible installation path for the git-version binary
Allow flexible installation path for the git-version binary in order to support self-hosted runners, where installation paths for tooling may vary Use elevated privileges to download + make tool executable
1 parent 995fc07 commit 60b3c3c

File tree

1 file changed

+29
-25
lines changed

1 file changed

+29
-25
lines changed

action.yml

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,51 @@
11
name: Git Version
22
author: "Codacy"
3-
description: 'Semver versioning based on the git history and commit messages of your repository.'
3+
description: "Semver versioning based on the git history and commit messages of your repository."
44
branding:
5-
icon: 'git-branch'
6-
color: 'gray-dark'
5+
icon: "git-branch"
6+
color: "gray-dark"
77
inputs:
88
tool-version:
9-
description: 'The version of the tool to be ran'
9+
description: "The version of the tool to be ran"
1010
required: true
1111
default: latest
12+
tool-installation-path:
13+
description: "The path where the tool will be installed"
14+
required: false
15+
default: /usr/local/bin
1216
release-branch:
13-
description: 'The name of the release branch'
17+
description: "The name of the release branch"
1418
required: true
1519
default: master
1620
dev-branch:
17-
description: 'The name of the dev branch'
21+
description: "The name of the dev branch"
1822
required: true
1923
default: dev
2024
minor-identifier:
21-
description: 'The string or regex to identify a minor release commit'
25+
description: "The string or regex to identify a minor release commit"
2226
required: true
23-
default: 'feature:'
27+
default: "feature:"
2428
major-identifier:
25-
description: 'The string or regex to identify a major release commit'
29+
description: "The string or regex to identify a major release commit"
2630
required: true
27-
default: 'breaking:'
31+
default: "breaking:"
2832
skip-prerelease:
29-
description: 'Skip prerelease part of the version. When true, release-branch and dev-branch are effectively ignored'
33+
description: "Skip prerelease part of the version. When true, release-branch and dev-branch are effectively ignored"
3034
required: true
31-
default: 'false'
35+
default: "false"
3236
prefix:
33-
description: 'The prefix to use in the version'
37+
description: "The prefix to use in the version"
3438
required: false
3539
log-paths:
36-
description: 'The paths to be used to calculate changes (comma-separated)'
40+
description: "The paths to be used to calculate changes (comma-separated)"
3741
required: false
3842
default: ./
3943
outputs:
4044
version:
41-
description: 'The value of the new pre-calculated tag'
45+
description: "The value of the new pre-calculated tag"
4246
value: ${{ steps.version.outputs.version }}
4347
previous-version:
44-
description: 'Contains the value of previous tag, before calculating a new one'
48+
description: "Contains the value of previous tag, before calculating a new one"
4549
value: ${{ steps.previous-version.outputs.previous-version }}
4650
runs:
4751
using: "composite"
@@ -54,21 +58,21 @@ runs:
5458
else
5559
download_url="https://github.com/codacy/git-version/releases/download/${{ inputs.tool-version }}/git-version"
5660
fi
57-
curl -Ls "$download_url" > /usr/local/bin/git-version
58-
chmod +x /usr/local/bin/git-version
61+
sudo wget "$download_url" -O "${{ inputs.tool-installation-path }}/git-version"
62+
sudo chmod +x "${{ inputs.tool-installation-path }}/git-version"
5963
- id: previous-version
6064
shell: bash
6165
run: |
6266
set -eo pipefail
6367
64-
export PREVIOUS_VERSION=$(git-version \
68+
export PREVIOUS_VERSION=$(${{ inputs.tool-installation-path }}/git-version \
6569
--previous-version \
6670
--release-branch "${{ inputs.release-branch }}" \
6771
--dev-branch "${{ inputs.dev-branch }}" \
6872
--minor-identifier="${{ inputs.minor-identifier }}" \
6973
--major-identifier="${{ inputs.major-identifier }}" \
70-
${{ inputs.skip-prerelease == 'true' && '--skip-prerelease' || '' }} \
71-
--version-prefix "${{ inputs.prefix }}")
74+
--version-prefix "${{ inputs.prefix }}" \
75+
${{ inputs.skip-prerelease == 'true' && '--skip-prerelease' || '' }})
7276
7377
echo "previous-version=$PREVIOUS_VERSION" >> $GITHUB_OUTPUT
7478
echo "Previous Version: $PREVIOUS_VERSION"
@@ -77,14 +81,14 @@ runs:
7781
run: |
7882
set -eo pipefail
7983
80-
export VERSION=$(git-version \
84+
export VERSION=$(${{ inputs.tool-installation-path }}/git-version \
8185
--release-branch "${{ inputs.release-branch }}" \
8286
--dev-branch "${{ inputs.dev-branch }}" \
8387
--minor-identifier="${{ inputs.minor-identifier }}" \
8488
--major-identifier="${{ inputs.major-identifier }}" \
85-
--log-paths="${{ inputs.log-paths }}" \
86-
${{ inputs.skip-prerelease == 'true' && '--skip-prerelease' || '' }} \
87-
--version-prefix "${{ inputs.prefix }}")
89+
--log-paths="${{ inputs.log-paths }}" \
90+
--version-prefix "${{ inputs.prefix }}" \
91+
${{ inputs.skip-prerelease == 'true' && '--skip-prerelease' || '' }})
8892
8993
echo "version=$VERSION" >> $GITHUB_OUTPUT
9094
echo "New Version: $VERSION"

0 commit comments

Comments
 (0)