Skip to content

Commit

Permalink
Attach statically build binary to release
Browse files Browse the repository at this point in the history
Since forever we have wanted to attach statically linked binaries of
the program to the corresponding release. However, because GitHub
Actions can't seem to get their Matrix workflows interacting with
anything, really, that seemed impossible to do.
This change proposes a workaround that makes each job of the matrix
attach the binary to the release itself, provided that the associated
input argument it set.
  • Loading branch information
d-e-s-o committed Dec 29, 2024
1 parent d6d9f5c commit 341cf70
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@
name: Build

on:
workflow_call:
inputs:
upload-release:
description: 'The release to upload artifacts to, if any'
default: ''
required: false
type: string
workflow_dispatch:

jobs:
Expand All @@ -24,3 +31,10 @@ jobs:
with:
name: apcacli
path: bin/apcacli
- if: ${{ inputs.upload-release != '' }}
name: Upload release asset
env:
GH_TOKEN: ${{ github.token }}
run: |
mv bin/apcacli apcacli
gh release upload ${{ inputs.upload-release }} apcacli
6 changes: 6 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,9 @@ jobs:
run: cargo publish --no-verify --token "${CARGO_REGISTRY_TOKEN}"
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
build-artifacts:
needs: [publish, version]
uses: ./.github/workflows/build.yml
secrets: inherit
with:
upload-release: v${{ needs.version.outputs.version }}

0 comments on commit 341cf70

Please sign in to comment.