Skip to content

Commit

Permalink
Add publish step to swift-toolbox in CI/CD (#1185)
Browse files Browse the repository at this point in the history
This PR adds a command to the Makefile which aids in publishing of the binary tools in console_backend.
  • Loading branch information
pcrumley authored Sep 15, 2023
1 parent 380344c commit 9802061
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,21 @@ PY_BASE_URL = "https://github.com/indygreg/python-build-standalone/releases/down
MACOSX_DEPLOYMENT_TARGET = "10.15"
APP_NAME = "swift-console"
QT_VERSION = "6.4.3" # Also needs to be updated in .github/workflows/main.yml
CARGO_MAKE_TOOL_PROJECT_NAME = "swift-console-tools"

[env.'release+mac_intel']
CARGO_MAKE_RELEASE_FLOW_TARGET = "x86_64-apple-darwin"

[env.'release+mac_arm']
CARGO_MAKE_RELEASE_FLOW_TARGET = "aarch64-apple-darwin"

[env.'release+x86_64']
CARGO_MAKE_RELEASE_FLOW_TARGET = "x86_64-unknown-linux-gnu"

[env.'release+aarch64']
CARGO_MAKE_RELEASE_FLOW_TARGET = "aarch64-unknown-linux-gnu"

#
[tasks.init]

# Two proposed methods of simplifying path globbing # https://github.com/sagiegurari/cargo-make/issues/542 # https://github.com/sagiegurari/cargo-make/issues/543
Expand Down Expand Up @@ -1369,3 +1383,37 @@ file = readfile resources/web/map/js/trajectory_raw.js
file_modified = replace ${file} "@ACCESS_TOKEN@" ${MAPBOX_TOKEN}
writefile "resources/web/map/js/trajectory.js" ${file_modified}
'''

[tasks.zip-release-binary-for-target]
description = "Zips up the release binary, README, and license(s)"
category = "Publish"
condition = { env_set = [
"CARGO_MAKE_RELEASE_FLOW_TARGET",
"CARGO_MAKE_TOOL_PROJECT_NAME",
"CARGO_MAKE_PROJECT_VERSION",
], env_true = [
"CARGO_MAKE_CI",
] }
env.OUTPUT_NAME = "${CARGO_MAKE_TOOL_PROJECT_NAME}-v${CARGO_MAKE_PROJECT_VERSION}-${CARGO_MAKE_RELEASE_FLOW_TARGET}"
env.TARGET_RELEASE_DIRECTORY = "target/${CARGO_MAKE_RELEASE_FLOW_TARGET}/release"
script_runner = "@duckscript"
script = '''
mkdir ${OUTPUT_NAME}
cp ${TARGET_RELEASE_DIRECTORY}/swift-settings ${OUTPUT_NAME}/swift-settings
cp ${TARGET_RELEASE_DIRECTORY}/swift-files ${OUTPUT_NAME}/swift-files
cp ${TARGET_RELEASE_DIRECTORY}/fft_monitor ${OUTPUT_NAME}/fft_monitor
cp ${TARGET_RELEASE_DIRECTORY}/headless-console ${OUTPUT_NAME}/headless-console
cp ${TARGET_RELEASE_DIRECTORY}/swift-updater ${OUTPUT_NAME}/swift-updater
cp ./README.md ${OUTPUT_NAME}/README.md
glob_cp ./LICENSE* ${OUTPUT_NAME}/
ls -l ${OUTPUT_NAME}/
if is_windows
exec --fail-on-error powershell Compress-Archive -Path ${OUTPUT_NAME}/* -DestinationPath ${OUTPUT_NAME}.zip
else
exec --fail-on-error zip -r ${OUTPUT_NAME}.zip ${OUTPUT_NAME}
end
'''

0 comments on commit 9802061

Please sign in to comment.