From 80c816f11db8dea5e3a81025f598193015b51832 Mon Sep 17 00:00:00 2001 From: Lorenzo Gabriele Date: Tue, 22 Nov 2022 17:06:39 +0100 Subject: [PATCH] feature: Use static binary instead of docker image (#75) * feature: Use static binary instead of docker image * Install in /usr/local/bin * Remove --folder /repo * Use tool-version when provided * Quote strings in bash --- action.yml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/action.yml b/action.yml index 3d4fd20..4080496 100644 --- a/action.yml +++ b/action.yml @@ -42,15 +42,23 @@ outputs: runs: using: "composite" steps: + - shell: bash + run: | + set -eo pipefail + if [ "${{ inputs.tool-version }}" = "latest" ]; then + download_url="$(curl -Ls https://api.github.com/repos/codacy/git-version/releases/latest | jq -r .assets[0].browser_download_url)" + else + download_url="https://github.com/codacy/git-version/releases/download/${{ inputs.tool-version }}/git-version" + fi + curl -Ls "$download_url" > /usr/local/bin/git-version + chmod +x /usr/local/bin/git-version - id: previous-version shell: bash run: | set -eo pipefail - export PREVIOUS_VERSION=$(docker run -v $(pwd):/repo codacy/git-version:${{ inputs.tool-version }} \ - /bin/git-version \ + export PREVIOUS_VERSION=$(git-version \ --previous-version \ - --folder /repo \ --release-branch "${{ inputs.release-branch }}" \ --dev-branch "${{ inputs.dev-branch }}" \ --minor-identifier="${{ inputs.minor-identifier }}" \ @@ -64,9 +72,7 @@ runs: run: | set -eo pipefail - export VERSION=$(docker run -v $(pwd):/repo codacy/git-version:${{ inputs.tool-version }} \ - /bin/git-version \ - --folder /repo \ + export VERSION=$(git-version \ --release-branch "${{ inputs.release-branch }}" \ --dev-branch "${{ inputs.dev-branch }}" \ --minor-identifier="${{ inputs.minor-identifier }}" \