3
0
Fork 0
mirror of https://github.com/dtolnay/install.git synced 2025-01-31 15:11:22 +01:00
cargo-install/.github/workflows/build.yml

72 lines
2.1 KiB
YAML
Raw Normal View History

name: build
on:
workflow_call:
inputs:
crate:
required: true
type: string
version:
required: false
type: string
bin:
required: false
type: string
2022-06-22 10:27:53 -07:00
git:
required: false
type: string
ref:
required: false
type: string
path:
2022-06-22 10:27:53 -07:00
required: false
type: string
toolchain:
required: false
type: string
default: stable
2023-10-08 10:01:23 -07:00
locked:
required: false
type: boolean
default: false
jobs:
build:
2021-10-08 00:42:30 -04:00
name: ${{inputs.crate}}
runs-on: ubuntu-latest
permissions:
2025-01-26 12:48:26 -08:00
id-token: write
contents: write
2025-01-26 12:48:26 -08:00
attestations: write
timeout-minutes: 45
steps:
2023-09-04 22:34:58 -07:00
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: ${{inputs.git}}
ref: ${{inputs.ref}}
path: ${{inputs.crate}}
if: inputs.git
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{inputs.toolchain}}
- run: cargo install --force ${{inputs.git && format('--path={0}', inputs.path || '.') || inputs.crate}} ${{inputs.version && format('--version={0}', inputs.version) || ''}} --bin ${{inputs.bin || inputs.crate}} ${{inputs.locked && '--locked' || ''}}
working-directory: ${{inputs.git && inputs.crate || '.'}}
- id: which
run: echo "which=$(which ${{inputs.bin || inputs.crate}})" >> $GITHUB_OUTPUT
2021-11-17 11:41:27 -08:00
- id: version
run: echo "version=$(cargo install --list | grep -o '^${{inputs.crate}} \([^ :]\)\+')" >> $GITHUB_OUTPUT
2025-01-26 12:48:26 -08:00
- uses: actions/attest-build-provenance@v2
with:
subject-path: ${{steps.which.outputs.which}}
2022-06-29 07:26:13 -07:00
- run: git tag -d ${{inputs.crate}} || true
- run: git tag ${{inputs.crate}}
- run: git push origin tag ${{inputs.crate}} --force
- uses: softprops/action-gh-release@v2
with:
tag_name: ${{inputs.crate}}
2022-06-29 07:26:13 -07:00
target_commitish: ${{github.ref}}
2025-01-26 14:00:53 -08:00
files: ${{steps.which.outputs.which}}
fail_on_unmatched_files: true
2021-11-17 11:41:27 -08:00
body: ${{steps.version.outputs.version}}