Make it possible to install cross from a git tag
This commit is contained in:
parent
a0b2ccd631
commit
c464bd9469
@ -1,3 +1,8 @@
|
|||||||
|
## 0.0.13
|
||||||
|
|
||||||
|
- It's now possible to set `cross-version` to a git ref like a commit hash or `HEAD`. This will
|
||||||
|
install `cross` from its git repo.
|
||||||
|
|
||||||
## 0.0.12 - 2024-02-25
|
## 0.0.12 - 2024-02-25
|
||||||
|
|
||||||
- Bumped the version of `actions/cache` used in this action to v4. The v3 version uses Node 16,
|
- Bumped the version of `actions/cache` used in this action to v4. The v3 version uses Node 16,
|
||||||
|
|||||||
20
README.md
20
README.md
@ -55,16 +55,16 @@ jobs:
|
|||||||
|
|
||||||
This action takes the following parameters:
|
This action takes the following parameters:
|
||||||
|
|
||||||
| Key | Type | Required? | Description |
|
| Key | Type | Required? | Description |
|
||||||
| ------------------- | ---------------------------------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
| ------------------- | ---------------------------------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| `command` | string (one of `build`, `test`, or `both`) | no | The command(s) to run. The default is `build`. Running the `test` command will fail with \*BSD targets, non-x86 Windows, and macOS ARM. |
|
| `command` | string (one of `build`, `test`, or `both`) | no | The command(s) to run. The default is `build`. Running the `test` command will fail with \*BSD targets, non-x86 Windows, and macOS ARM. |
|
||||||
| `target` | string | yes | The target triple to compile for. This should be one of the targets found by running `rustup target list`. |
|
| `target` | string | yes | The target triple to compile for. This should be one of the targets found by running `rustup target list`. |
|
||||||
| `working-directory` | string | no | The working directory in which to run the `cargo` or `cross` commands. Defaults to the current directory (`.`). |
|
| `working-directory` | string | no | The working directory in which to run the `cargo` or `cross` commands. Defaults to the current directory (`.`). |
|
||||||
| `toolchain` | string (one of `stable`, `beta`, or `nightly`) | no | The Rust toolchain version to install. The default is `stable`. |
|
| `toolchain` | string (one of `stable`, `beta`, or `nightly`) | no | The Rust toolchain version to install. The default is `stable`. |
|
||||||
| `GITHUB_TOKEN` | string | no | Defaults to the value of `${{ github.token }}`. |
|
| `GITHUB_TOKEN` | string | no | Defaults to the value of `${{ github.token }}`. |
|
||||||
| `args` | string | no | A string-separated list of arguments to be passed to `cross build`, like `--release --locked`. |
|
| `args` | string | no | A string-separated list of arguments to be passed to `cross build`, like `--release --locked`. |
|
||||||
| `strip` | boolean (`true` or `false`) | no | If this is true, then the resulting binaries will be stripped if possible. This is only possible for binaries which weren't cross-compiled. |
|
| `strip` | boolean (`true` or `false`) | no | If this is true, then the resulting binaries will be stripped if possible. This is only possible for binaries which weren't cross-compiled. |
|
||||||
| `cross-version` | string | no | This can be used to set the version of `cross` to use. If specified, it should be a specific `cross` release tag. If this is not set then the latest version will always be used. |
|
| `cross-version` | string | no | This can be used to set the version of `cross` to use. If specified, it should be a specific `cross` release tag (like `v0.2.3`) or a git ref (commit hash, `HEAD`, etc.). If this is not set then the latest released version will always be used. If this is set to a git ref then the version corresponding to that ref will be installed. |
|
||||||
|
|
||||||
## How it Works
|
## How it Works
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
set -x
|
set -x
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
@ -5,12 +7,19 @@ set -o pipefail
|
|||||||
CROSS_DIR="$1"
|
CROSS_DIR="$1"
|
||||||
VERSION="$2"
|
VERSION="$2"
|
||||||
|
|
||||||
|
cd "$CROSS_DIR"
|
||||||
|
|
||||||
|
if [[ -n "$VERSION" ]] && ! [[ "$VERSION" =~ ^v ]]; then
|
||||||
|
cargo install cross --git https://github.com/cross-rs/cross --rev "$VERSION"
|
||||||
|
mv "$HOME/.cargo/bin/cross" .
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
VERSION_ARGS=""
|
VERSION_ARGS=""
|
||||||
if [ -n "$VERSION" ]; then
|
if [ -n "$VERSION" ]; then
|
||||||
VERSION_ARGS="--tag $VERSION"
|
VERSION_ARGS="--tag $VERSION"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd "$CROSS_DIR"
|
|
||||||
export TARGET=.
|
export TARGET=.
|
||||||
curl --silent --location \
|
curl --silent --location \
|
||||||
https://raw.githubusercontent.com/houseabsolute/ubi/master/bootstrap/bootstrap-ubi.sh |
|
https://raw.githubusercontent.com/houseabsolute/ubi/master/bootstrap/bootstrap-ubi.sh |
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user