You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
GitHub Action
cargo-generate
v0.11.0
This action is used to run the cargo-generate
tool in order to expand a template.
This is pushed to docker hub cargogenerate/cargo-generate-action.
Required
This is the name of the project being expanded.
This is the URL/path to the repository holding the template. Defaults to .
Branch for cloning the template.
Subfolder within the template repository that'll be used as the template.
Specifies a file holding the values required for template expansion.
NOTE:
cargo-generate
is being run with the--silent
option, so it will fail if any values are undefined during expansion.
This can be used to specify any other option for cargo-generate
.
Example:
other: "--define foo=\"value\" --define bar=42"
name: Try to expand local template using cargo-template
on:
push:
jobs:
build:
runs-on: ubuntu-latest
env:
PROJECT_NAME: mytemplate
steps:
- uses: actions/checkout@v2
- uses: cargo-generate/[email protected]
with:
name: ${{ env.PROJECT_NAME }}
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
# we need to move the generated project to a temp folder, away from the template project
# otherwise `cargo` runs would fail
# see https://github.com/rust-lang/cargo/issues/9922
- run: |
mv $PROJECT_NAME ${{ runner.temp }}/
cd ${{ runner.temp }}/$PROJECT_NAME
cargo check