3
0
Fork 0
mirror of https://github.com/dtolnay/install.git synced 2024-11-23 00:39:30 +01:00
cargo-install/.github/workflows/build.yml

54 lines
1.9 KiB
YAML
Raw Normal View History

name: build
on:
workflow_call:
inputs:
crate:
required: true
type: string
bin:
required: false
type: string
2022-06-22 19:27:53 +02:00
git:
required: false
type: string
branch:
required: false
type: string
2021-10-08 06:46:40 +02:00
secrets:
private_key:
required: true
jobs:
build:
2021-10-08 06:42:30 +02:00
name: ${{inputs.crate}}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
2022-06-22 19:27:53 +02:00
- run: cargo install --force ${{inputs.crate}} --bin ${{inputs.bin || inputs.crate}} ${{inputs.git && format('--git={0}', inputs.git) || ''}} ${{inputs.branch && format('--branch={0}', inputs.branch) || ''}}
- id: which
run: echo "::set-output name=which::$(which ${{inputs.bin || inputs.crate}})"
2021-11-17 20:41:27 +01:00
- id: version
2021-11-17 20:52:32 +01:00
run: echo "::set-output name=version::$(cargo install --list | grep -o '^${{inputs.crate}} \([^ :]\)\+')"
- run: echo "$PRIVATE_KEY" | gpg --import
env:
2021-10-08 06:46:40 +02:00
PRIVATE_KEY: ${{secrets.private_key}}
- run: gpg --output ${{inputs.bin || inputs.crate}}.sig --detach-sig ${{steps.which.outputs.which}}
- run: gpg --output signing-key.gpg --dearmor signing-key.asc
- run: gpg --no-default-keyring --keyring ./signing-key.gpg --verify ${{inputs.bin || inputs.crate}}.sig ${{steps.which.outputs.which}}
2022-06-29 16:26:13 +02: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@v1
with:
tag_name: ${{inputs.crate}}
2022-06-29 16:26:13 +02:00
target_commitish: ${{github.ref}}
files: |
${{steps.which.outputs.which}}
${{inputs.bin || inputs.crate}}.sig
fail_on_unmatched_files: true
2021-11-17 20:41:27 +01:00
body: ${{steps.version.outputs.version}}