diff --git a/action.yml b/action.yml index f148c4b..120fbee 100644 --- a/action.yml +++ b/action.yml @@ -6,7 +6,7 @@ inputs: description: "The path to your cabal file, e.g. somefolder/myproject.cabal" required: true version: - description: "Version of the tool" + description: "Version of the get-tested tool" required: false default: "" windows: @@ -44,23 +44,15 @@ runs: steps: - name: Checkout base repo uses: actions/checkout@v4 + + - name: Set up get-tested + uses: ./setup-get-tested + with: + version: ${{ inputs.version }} + - name: Set up options shell: bash run: | - gh_release_flags=( - --repo Kleidukos/get-tested - --pattern 'get-tested-*-Linux-static-x86_64.tar.gz' - --output get-tested.tar.gz - ) - if [[ "${{ inputs.version }}" != "" ]] - then - gh release download "v${{ inputs.version }}" "${gh_release_flags[@]}" - else - gh release download "${gh_release_flags[@]}" - fi - tar -xzvf get-tested.tar.gz - chmod +x get-tested - echo "::debug:: macOS: ${{ inputs.macos-version }}" echo "::debug:: windows: ${{ inputs.windows-version }}" echo "::debug:: ubuntu: ${{ inputs.ubuntu-version }}" diff --git a/setup-get-tested/action.yml b/setup-get-tested/action.yml new file mode 100644 index 0000000..e0a7e36 --- /dev/null +++ b/setup-get-tested/action.yml @@ -0,0 +1,45 @@ +name: "Set up get-tested" +description: "Fetches the get-tested tool" + +inputs: + version: + description: "The version of the get-tested tool. Defaults to 'latest' if unspecified." + required: false + default: "" + directory: + description: "The directory where the get-tested executable should be placed." + required: false + default: "." + +outputs: + path: + description: "The path to the get-tested executable." + value: ${{ steps.setup.outputs.path }} + +runs: + using: "composite" + steps: + - name: Set up get-tested + id: setup + shell: bash + run: | + gh_release_flags=( + --repo Kleidukos/get-tested + --pattern 'get-tested-*-Linux-static-x86_64.tar.gz' + --output get-tested.tar.gz + ) + + if [[ "${{ inputs.version }}" != "" ]]; then + gh release download "v${{ inputs.version }}" "${gh_release_flags[@]}" + else + gh release download "${gh_release_flags[@]}" + fi + tar -x -v -z -f get-tested.tar.gz -C "${{ inputs.directory }}" + + path="${{ inputs.directory }}/get-tested" + chmod a+x "${path}" + echo "path=${path}" >> "${GITHUB_OUTPUT}" + +branding: + icon: 'list' + color: 'blue'