From ecfa8603a40094c9f29d74bbbc4a5be4fac8b951 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Pich=C3=A9?= Date: Fri, 12 Jul 2024 17:09:12 -0400 Subject: [PATCH] GitHub Action to install TGF --- .github/workflows/test-install.yml | 22 ++++++++++++++++++++ README.md | 11 ++++++++++ action.yml | 32 ++++++++++++++++++++++++++++++ 3 files changed, 65 insertions(+) create mode 100644 action.yml diff --git a/.github/workflows/test-install.yml b/.github/workflows/test-install.yml index 5aa1b74..76477da 100644 --- a/.github/workflows/test-install.yml +++ b/.github/workflows/test-install.yml @@ -9,6 +9,7 @@ on: jobs: posix: strategy: + fail-fast: false matrix: os: [ macos-latest, ubuntu-latest ] runs-on: ${{ matrix.os }} @@ -17,9 +18,30 @@ jobs: - uses: actions/checkout@v4 - run: ./get-latest-tgf.sh + windows: runs-on: windows-latest steps: - uses: actions/checkout@v4 - run: ./get-latest-tgf.ps1 + + + action: + strategy: + fail-fast: false + matrix: + os: [macos-latest, ubuntu-latest, windows-latest] + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v4 + - uses: ./ + with: + ref: ${{ github.head_ref }} + + - run: tgf --help-tgf + if: runner.os != 'Windows' + + - run: ./tgf --help-tgf + if: runner.os == 'Windows' diff --git a/README.md b/README.md index a935b9d..c9d9d60 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,17 @@ outdated version. ## Installation +### GitHub Action + +You can install `TGF` using the provided GitHub Action: + +``` + steps: + - uses: coveooss/tgf@master +``` + +### Manual installation + On `mac` and `linux`: You can run the `get-latest-tgf.sh` script to check if you have the latest version of tgf installed and install it as needed: diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..02402a6 --- /dev/null +++ b/action.yml @@ -0,0 +1,32 @@ +name: Install TGF +description: GitHub Action to install https://github.com/coveooss/tgf + +inputs: + tgf-path: + description: Installs the TGF binary to this folder. The folder will not be added to the PATH. + required: false + ref: + description: The ref to use to run the install script. + default: ${{ github.action_ref }} + required: false + + +runs: + using: "composite" + steps: + - name: Install TGF (posix) + if: runner.os != 'Windows' + shell: bash + env: + TGF_PATH: ${{ inputs.tgf-path }} + VERSION: ${{ inputs.ref }} + run: curl "https://raw.githubusercontent.com/coveooss/tgf/${VERSION}/get-latest-tgf.sh" | bash + + - name: Install TGF (windows) + if: runner.os == 'Windows' + shell: pwsh + env: + TGF_PATH: ${{ inputs.tgf-path }} + VERSION: ${{ inputs.ref }} + run: | + (Invoke-WebRequest https://raw.githubusercontent.com/coveooss/tgf/${env:VERSION}/get-latest-tgf.ps1).Content | Invoke-Expression