diff --git a/.github/workflows/gh-action.yml b/.github/workflows/gh-action.yml new file mode 100644 index 00000000..b09f1841 --- /dev/null +++ b/.github/workflows/gh-action.yml @@ -0,0 +1,36 @@ +name: Test GitHub Action installer +on: + merge_group: + pull_request: + paths: + - install-from-binstall-release.ps1 + - install-from-binstall-release.sh + - action.yml + push: + branches: + - main + paths: + - install-from-binstall-release.ps1 + - install-from-binstall-release.sh + - action.yml + +jobs: + test-gha-installer: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ macos-latest, ubuntu-latest, windows-latest ] + steps: + - uses: actions/checkout@v3 + + - name: Install cargo-binstall + uses: ./ # uses action.yml from root of the repo + + - name: Verify successful installation - display cargo-binstall's help + run: cargo binstall --help + + - name: Verify successful installation - install example binary using cargo-binstall + run: cargo binstall -y ripgrep + + - name: Verify successful installation - display help of installed binary + run: rg --help diff --git a/README.md b/README.md index a70ef72f..b4144bf6 100644 --- a/README.md +++ b/README.md @@ -107,6 +107,10 @@ Supported crates such as `cargo-binstall` itself can also be updated with `cargo - You can find a full description of errors including exit codes here: - Can I use it in CI? - Yes! For GitHub Actions, we recommend the excellent [taiki-e/install-action](https://github.com/marketplace/actions/install-development-tools), which has explicit support for selected tools and uses `cargo-binstall` for everything else. + - Additionally, we provide a minimal GitHub Action that installs `cargo-binstall`: + ```yml + - uses: cargo-bins/cargo-binstall@main + ``` - Are debug symbols available? - Yes! Extra pre-built packages with a `.full` suffix are available and contain split debuginfo, documentation files, and extra binaries like the `detect-wasi` utility. diff --git a/action.yml b/action.yml new file mode 100644 index 00000000..3c3b1663 --- /dev/null +++ b/action.yml @@ -0,0 +1,14 @@ +name: 'Install cargo-binstall' +description: 'Install the latest version of cargo-binstall tool' + +runs: + using: composite + steps: + - name: Install cargo-binstall + if: runner.os != 'Windows' + shell: sh + run: curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash + - name: Install cargo-binstall + if: runner.os == 'Windows' + run: Set-ExecutionPolicy Unrestricted -Scope Process; iex (iwr "https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.ps1").Content + shell: powershell