3
0
Fork 0
mirror of https://github.com/dtolnay/install.git synced 2024-11-23 08:39:31 +01:00
cargo-install/.github/workflows/build.yml
David Tolnay 59115418f6
Time out workflows after 45 minutes
GitHub's default timeout is 6 hours. Recently some of my GitHub Actions
jobs have started randomly stalling for that long, which is inconvenient
because it ties up a chunk of my runner quota. It apepars to be very
rare for a job to recover after stalling. It's better to time out
quicker and retry on a different runner.
2022-11-24 21:37:30 -08:00

54 lines
1.9 KiB
YAML

name: build
on:
workflow_call:
inputs:
crate:
required: true
type: string
bin:
required: false
type: string
git:
required: false
type: string
branch:
required: false
type: string
secrets:
private_key:
required: true
jobs:
build:
name: ${{inputs.crate}}
runs-on: ubuntu-latest
permissions:
contents: write
timeout-minutes: 45
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- 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 "which=$(which ${{inputs.bin || inputs.crate}})" >> $GITHUB_OUTPUT
- id: version
run: echo "version=$(cargo install --list | grep -o '^${{inputs.crate}} \([^ :]\)\+')" >> $GITHUB_OUTPUT
- run: echo "$PRIVATE_KEY" | gpg --import
env:
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}}
- 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}}
target_commitish: ${{github.ref}}
files: |
${{steps.which.outputs.which}}
${{inputs.bin || inputs.crate}}.sig
fail_on_unmatched_files: true
body: ${{steps.version.outputs.version}}