-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🚦 Add workflow for bundling binaries
This adds an automatic workflow that bundles binaries and releases them as artifacts upon completion. To start with, this only does this process for macOS binaries; with the intention of adding more in the near future. There is a large chance that this process will change several times over the course of this project, especially seeing as `cargo-bundle` is not very well fleshed-out and fails to draw values correctly from workspace `Cargo.toml` files.
- Loading branch information
1 parent
a3e13e4
commit d00dcc3
Showing
2 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: cargo-bundle | ||
description: "Performs a cargo bundle step, with caching" | ||
inputs: | ||
profile: | ||
default: dev | ||
description: "The build profile to use" | ||
required: false | ||
path: | ||
description: "Path to the binary that is being bundled" | ||
required: true | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Install cargo-bundle | ||
uses: ./.github/actions/cargo-install | ||
with: | ||
target: cargo-bundle | ||
|
||
- name: Bundle | ||
id: bundle | ||
shell: bash | ||
working-directory: ${{ inputs.path }} | ||
run: | ||
if [[ ${{ inputs.profile }} = "dev" ]]; then | ||
target_type="debug" | ||
else | ||
target_type="${{ inputs.profile }}" | ||
fi | ||
app_dir=$(find ${{ github.workspace }}/target/${target_type} -type d -name '*.app' | head -n 1) | ||
app_name=$(basename "${app_dir}") | ||
cargo bundle | ||
cp -r ${VULKAN_SDK}/lib/libvulkan* ${app_dir}/Contents/Frameworks | ||
cp -r ${VULKAN_SDK}/lib/libMoltenVK* ${app_dir}/Contents/Frameworks | ||
install_name_tool -add_rpath "@executable_path/../Frameworks" ${app_dir}/Contents/MacOS/* | ||
echo "application=${app_dir}" >> ${GITHUB_OUTPUT} | ||
echo "application_name=${app_name}" >> ${GITHUB_OUTPUT} | ||
|
||
- name: Upload Bundle Artifact | ||
uses: actions/upload-artifact@v1 | ||
if: steps.bundle.outcome == 'success' | ||
continue-on-error: true | ||
with: | ||
name: ${{ steps.bundle.outputs.application_name }} | ||
path: ${{ steps.bundle.outputs.application }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: Bundle Binaries | ||
on: | ||
workflow_run: | ||
workflows: [ build ] | ||
types: | ||
- completed | ||
workflow_dispatch: | ||
inputs: | ||
profile: | ||
description: "The build profile to use" | ||
required: false | ||
default: dev | ||
options: | ||
- dev | ||
- release | ||
type: choice | ||
workflow_call: | ||
inputs: | ||
profile: | ||
description: "The build profile to use" | ||
default: dev | ||
required: false | ||
type: string | ||
|
||
jobs: | ||
example-app-macos: | ||
name: Bundle MacOS Binary | ||
runs-on: macos-latest | ||
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Prepare runner | ||
uses: ./.github/actions/prepare-runner | ||
|
||
- name: Install toolchain | ||
uses: ./.github/actions/rust-toolchain | ||
|
||
- name: Build | ||
uses: ./.github/actions/cargo-build | ||
with: | ||
profile: ${{ inputs.profile }} | ||
|
||
- name: Bundle | ||
uses: ./.github/actions/cargo-bundle | ||
with: | ||
profile: ${{ inputs.profile }} | ||
path: example |