2021-10-08 06:40:08 +02:00
|
|
|
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
|
2022-12-02 00:04:14 +01:00
|
|
|
ref:
|
|
|
|
required: false
|
|
|
|
type: string
|
|
|
|
path:
|
2022-06-22 19:27:53 +02:00
|
|
|
required: false
|
|
|
|
type: string
|
2021-10-08 06:46:40 +02:00
|
|
|
secrets:
|
|
|
|
private_key:
|
|
|
|
required: true
|
2021-10-08 06:40:08 +02:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
2021-10-08 06:42:30 +02:00
|
|
|
name: ${{inputs.crate}}
|
2021-10-08 06:40:08 +02:00
|
|
|
runs-on: ubuntu-latest
|
2022-06-20 12:15:03 +02:00
|
|
|
permissions:
|
|
|
|
contents: write
|
2022-11-25 06:35:28 +01:00
|
|
|
timeout-minutes: 45
|
2021-10-08 06:40:08 +02:00
|
|
|
steps:
|
2023-09-05 07:34:58 +02:00
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/checkout@v4
|
2022-12-02 00:04:14 +01:00
|
|
|
with:
|
|
|
|
repository: ${{inputs.git}}
|
|
|
|
ref: ${{inputs.ref}}
|
|
|
|
path: ${{inputs.crate}}
|
|
|
|
if: inputs.git
|
2021-10-08 06:40:08 +02:00
|
|
|
- uses: dtolnay/rust-toolchain@stable
|
2022-12-02 00:04:14 +01:00
|
|
|
- run: cargo install --force ${{inputs.git && format('--path={0}', inputs.path || '.') || inputs.crate}} --bin ${{inputs.bin || inputs.crate}}
|
|
|
|
working-directory: ${{inputs.git && inputs.crate || '.'}}
|
2021-10-08 06:40:08 +02:00
|
|
|
- id: which
|
2022-10-13 18:35:44 +02:00
|
|
|
run: echo "which=$(which ${{inputs.bin || inputs.crate}})" >> $GITHUB_OUTPUT
|
2021-11-17 20:41:27 +01:00
|
|
|
- id: version
|
2022-10-13 18:35:44 +02:00
|
|
|
run: echo "version=$(cargo install --list | grep -o '^${{inputs.crate}} \([^ :]\)\+')" >> $GITHUB_OUTPUT
|
2021-10-08 06:40:08 +02:00
|
|
|
- run: echo "$PRIVATE_KEY" | gpg --import
|
|
|
|
env:
|
2021-10-08 06:46:40 +02:00
|
|
|
PRIVATE_KEY: ${{secrets.private_key}}
|
2021-10-08 06:40:08 +02:00
|
|
|
- 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
|
2021-10-08 06:40:08 +02:00
|
|
|
- uses: softprops/action-gh-release@v1
|
|
|
|
with:
|
2021-10-09 02:38:20 +02:00
|
|
|
tag_name: ${{inputs.crate}}
|
2022-06-29 16:26:13 +02:00
|
|
|
target_commitish: ${{github.ref}}
|
2021-10-08 06:40:08 +02:00
|
|
|
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}}
|