From 72837b563531c32b37d8ac9374b7b72995cba08b Mon Sep 17 00:00:00 2001 From: Matt Haggard Date: Mon, 28 Aug 2023 16:10:42 -0400 Subject: [PATCH] Add `fallback` option for falling back to another installation method --- README.md | 18 ++++ action.yml | 4 +- ...new-Add-fallback-option-20230828-160957.md | 1 + install-nim.sh | 89 +++++++++++-------- 4 files changed, 74 insertions(+), 38 deletions(-) create mode 100644 changes/new-Add-fallback-option-20230828-160957.md diff --git a/README.md b/README.md index c23eebb..91974fe 100644 --- a/README.md +++ b/README.md @@ -86,6 +86,24 @@ jobs: nimble test ``` +## Fallback to a different install method + +```yaml +jobs: + tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - uses: iffy/install-nim@v4 + with: + version: binary:stable + fallback: git:2382937843092342342556456 + - name: Test + run: | + nimble install -y + nimble test +``` + If you run into trouble with GitHub rate limits, set the `GITHUB_TOKEN` environment variable like this: ```yaml diff --git a/action.yml b/action.yml index 04c9fe9..af197a5 100644 --- a/action.yml +++ b/action.yml @@ -7,6 +7,8 @@ branding: inputs: version: default: stable + fallback: + default: '' runs: using: composite @@ -15,4 +17,4 @@ runs: shell: bash run: | export SHELL=/bin/bash - "${GITHUB_ACTION_PATH}/install-nim.sh" '${{ inputs.version }}' + "${GITHUB_ACTION_PATH}/install-nim.sh" '${{ inputs.version }}' '${{ inputs.fallback }}' diff --git a/changes/new-Add-fallback-option-20230828-160957.md b/changes/new-Add-fallback-option-20230828-160957.md new file mode 100644 index 0000000..d02afd2 --- /dev/null +++ b/changes/new-Add-fallback-option-20230828-160957.md @@ -0,0 +1 @@ +Add `fallback` option for falling back to another installation method diff --git a/install-nim.sh b/install-nim.sh index 02dcc7a..4374c6e 100755 --- a/install-nim.sh +++ b/install-nim.sh @@ -7,7 +7,8 @@ usage() { cat <