diff --git a/.github/workflows/test-updatecli-run.yml b/.github/workflows/test-updatecli-run.yml index d8561772..2cb6551a 100644 --- a/.github/workflows/test-updatecli-run.yml +++ b/.github/workflows/test-updatecli-run.yml @@ -22,9 +22,10 @@ permissions: jobs: test: needs: + - default - version - version-file - - default + - version-file-updatecli runs-on: ubuntu-latest steps: - id: check @@ -40,24 +41,62 @@ jobs: - uses: ./updatecli/run with: command: help + - name: Verify updatecli version + run: | + want=$(cat updatecli/install/.default-updatecli-version | cut -dv -f2) + got=$(updatecli version 2>&1) + echo "${got} == ${want}" + [[ "${got}" == *"${want}"* ]] version: runs-on: ubuntu-latest + env: + want: "0.86.0" steps: - uses: actions/checkout@v4 - uses: ./updatecli/run with: command: help - version: v0.86.0 + version: "v${{ env.want }}" + - name: Verify updatecli version + run: | + got=$(updatecli version 2>&1) + echo "${got} == ${want}" + [[ "${got}" == *"${want}"* ]] version-file: runs-on: ubuntu-latest + env: + want: "0.85.0" steps: - uses: actions/checkout@v4 - name: Setup version file run: | - echo "v0.87.0" > .tools-version + echo "v${want}" > .tools-version - uses: ./updatecli/run with: command: help version-file: .tools-version + - name: Verify updatecli version + run: | + got=$(updatecli version 2>&1) + echo "${got} == ${want}" + [[ "${got}" == *"${want}"* ]] + + version-file-updatecli: + runs-on: ubuntu-latest + env: + want: "0.84.0" + steps: + - uses: actions/checkout@v4 + - name: Setup version file + run: | + echo "updatecli v${want}" > .tools-version + - uses: ./updatecli/install + with: + version-file: .tools-version + - name: Verify updatecli version + run: | + got=$(updatecli version 2>&1) + echo "${got} == ${want}" + [[ "${got}" == *"${want}"* ]] diff --git a/updatecli/install/README.md b/updatecli/install/README.md index 028d86bf..aff298e4 100644 --- a/updatecli/install/README.md +++ b/updatecli/install/README.md @@ -1,6 +1,7 @@ # updatecli/install [![usages](https://img.shields.io/badge/usages-white?logo=githubactions&logoColor=blue)](https://github.com/search?q=elastic%2Foblt-actions%2Fupdatecli%2Finstall+%28path%3A.github%2Fworkflows+OR+path%3A**%2Faction.yml+OR+path%3A**%2Faction.yaml%29&type=code) +[![test-updatecli-install](https://github.com/elastic/oblt-actions/actions/workflows/test-updatecli-install.yml/badge.svg?branch=main)](https://github.com/elastic/oblt-actions/actions/workflows/test-updatecli-install.yml) This is an opinionated GitHub Action to install the updatecli diff --git a/updatecli/run-and-notify/README.md b/updatecli/run-and-notify/README.md index 9db06848..2239fffe 100644 --- a/updatecli/run-and-notify/README.md +++ b/updatecli/run-and-notify/README.md @@ -13,13 +13,15 @@ notifications. ## Inputs -| Name | Description | Required | Default | -|--------------------|-----------------------------------------------------|----------|-----------| -| `command` | Specify the updatecli command to be executed. | `true` | ` ` | -| `slack-channel-id` | | `true` | ` ` | -| `slack-bot-token` | Specify the slack bot token. | `true` | ` ` | -| `slack-message` | Specify the message to be sent (markdown format). | `true` | ` ` | -| `slack-send-when` | When to send the message, always, failure, success. | `false` | `failure` | +| Name | Description | Required | Default | +|--------------------|---------------------------------------------------------------------------------------------------------------------|----------|-----------| +| `command` | Specify the updatecli command to be executed. | `true` | ` ` | +| `slack-channel-id` | | `true` | ` ` | +| `slack-bot-token` | Specify the slack bot token. | `true` | ` ` | +| `slack-message` | Specify the message to be sent (markdown format). | `true` | ` ` | +| `slack-send-when` | When to send the message, always, failure, success. | `false` | `failure` | +| `version` | Install a specific version of updatecli. If both `version` and `version-file` are provided, `version` will be used. | `false` | ` ` | +| `version-file` | The file to read the version from. E.g. `.updatecli-version` or `.tool-versions` (asdf-vm). | `false` | ` ` | ## Usage diff --git a/updatecli/run-and-notify/action.yml b/updatecli/run-and-notify/action.yml index e0ef491c..c0b39962 100644 --- a/updatecli/run-and-notify/action.yml +++ b/updatecli/run-and-notify/action.yml @@ -19,12 +19,20 @@ inputs: description: 'When to send the message, always, failure, success.' default: 'failure' required: false + version: + description: "Install a specific version of updatecli. If both `version` and `version-file` are provided, `version` will be used." + required: false + version-file: + description: "The file to read the version from. E.g. `.updatecli-version` or `.tool-versions` (asdf-vm)." + required: false runs: using: composite steps: - uses: elastic/oblt-actions/updatecli/run@v1 with: command: ${{ inputs.command }} + version: "${{ inputs.version }}" + version-file: "${{ inputs.version-file }}" - if: ${{ always() && inputs.slack-send-when == 'always' }} uses: elastic/oblt-actions/slack/send@v1 diff --git a/updatecli/run/README.md b/updatecli/run/README.md index 9f42ec9a..83982598 100644 --- a/updatecli/run/README.md +++ b/updatecli/run/README.md @@ -1,13 +1,16 @@ # updatecli/run [![usages](https://img.shields.io/badge/usages-white?logo=githubactions&logoColor=blue)](https://github.com/search?q=elastic%2Foblt-actions%2Fupdatecli%2Frun+%28path%3A.github%2Fworkflows+OR+path%3A**%2Faction.yml+OR+path%3A**%2Faction.yaml%29&type=code) +[![test-updatecli-run](https://github.com/elastic/oblt-actions/actions/workflows/test-updatecli-run.yml/badge.svg?branch=main)](https://github.com/elastic/oblt-actions/actions/workflows/test-updatecli-run.yml) ## Inputs -| Name | Description | Required | Default | -|-----------|-----------------------------------------------|----------|---------| -| `command` | Specify the updatecli command to be executed. | `true` | ` ` | +| Name | Description | Required | Default | +|----------------|---------------------------------------------------------------------------------------------------------------------|----------|---------| +| `command` | Specify the updatecli command to be executed. | `true` | ` ` | +| `version` | Install a specific version of updatecli. If both `version` and `version-file` are provided, `version` will be used. | `false` | ` ` | +| `version-file` | The file to read the version from. E.g. `.updatecli-version` or `.tool-versions` (asdf-vm). | `false` | ` ` | ## Usage diff --git a/updatecli/run/action.yml b/updatecli/run/action.yml index 5c026d6d..93cc1386 100644 --- a/updatecli/run/action.yml +++ b/updatecli/run/action.yml @@ -5,10 +5,19 @@ inputs: command: description: 'Specify the updatecli command to be executed.' required: true + version: + description: "Install a specific version of updatecli. If both `version` and `version-file` are provided, `version` will be used." + required: false + version-file: + description: "The file to read the version from. E.g. `.updatecli-version` or `.tool-versions` (asdf-vm)." + required: false runs: using: composite steps: - uses: elastic/oblt-actions/updatecli/install@v1 + with: + version: "${{ inputs.version }}" + version-file: "${{ inputs.version-file }}" - run: updatecli ${{ env.COMMAND }} env: