-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(.circleci): auto-publish artifacts when new tags are pushed
Signed-off-by: Taiga Nakayama <dora@dora-gt.jp>
- Loading branch information
Showing
7 changed files
with
502 additions
and
63 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
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,35 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Build musl binary inside a Docker container and copy it to local disk. | ||
# This script requires docker command. | ||
# `crate_name` ($1) is expected to be the same as bin name. | ||
# | ||
# 1) Spin up a new container of "clux/muslrust:stable" | ||
# 2) Copy source code etc. to the container | ||
# 3) Build a musl binary of the specified crate ($1) inside the container | ||
# 4) Copy the built binary to local disk space ($2) | ||
|
||
crate_name=$1 | ||
artifacts_path=$2 | ||
docker_image_name="clux/muslrust:stable" | ||
|
||
if [ -z "${crate_name}" ]; then | ||
printf "%s\n" "crate_name is required." | ||
exit 1 | ||
fi | ||
if [ -z "${artifacts_path}" ]; then | ||
printf "%s\n" "artifacts_path is required." | ||
exit 1 | ||
fi | ||
|
||
docker run -dt --name builder "${docker_image_name}" | ||
|
||
docker cp ./Cargo.toml builder:/usr/src/Cargo.toml | ||
docker cp ./Cargo.lock builder:/usr/src/Cargo.lock | ||
docker cp ./src builder:/usr/src/src | ||
|
||
# "--workdir" requires API version 1.35, but the Docker daemon API version of CircleCI is 1.32 | ||
docker exec builder "/bin/bash" "-c" "cd /usr/src && cargo build --release --features \"ethereum\" --package \"${crate_name}\" --bin \"${crate_name}\" --target x86_64-unknown-linux-musl" | ||
docker cp "builder:/usr/src/target/x86_64-unknown-linux-musl/release/${crate_name}" "${artifacts_path}" | ||
|
||
docker stop builder |
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,13 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Returns a crate name to build from a git tag name. | ||
# The tag name is assumed to be output by `cargo release` or be tagged manually. | ||
|
||
# The regex means "(something)-(semantic version)" | ||
if [[ $1 =~ ^(.*)-v([0-9]+)\.([0-9]+)\.([0-9]+)(-([0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*))?(\+[0-9A-Za-z-]+)?$ ]]; then | ||
echo ${BASH_REMATCH[1]} | ||
elif [[ $1 =~ ^v([0-9]+)\.([0-9]+)\.([0-9]+)(-([0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*))?(\+[0-9A-Za-z-]+)?$ ]]; then | ||
echo "interledger-settlement-engines" | ||
elif [[ $1 =~ ^interledger-settlement-engines-.*$ ]]; then | ||
echo "interledger-settlement-engines" | ||
fi |
Oops, something went wrong.