Skip to content

Commit

Permalink
remove dynamic libs from OSX builds
Browse files Browse the repository at this point in the history
add build_macos dependency for publish_release

move bundling to one script

add publish-release script.
  • Loading branch information
gmas committed Jan 18, 2019
1 parent 60747bb commit a4c7af8
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 35 deletions.
26 changes: 17 additions & 9 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,16 @@ jobs:
- run:
name: Create macos bundle
command: ./build-macos.sh && tar -zcvf filecoin.tar.gz filecoin
command: ./scripts/build-bundle.sh
- store_artifacts:
path: "~/go/src/github.com/filecoin-project/go-filecoin/filecoin.tar.gz"
destination: filecoin.tar.gz
path: "~/go/src/github.com/filecoin-project/go-filecoin/filecoin-Darwin.tar.gz"
destination: filecoin-Darwin.tar.gz
- store_test_results:
path: test-results
- persist_to_workspace:
root: "."
paths:
- "filecoin-Darwin.tar.gz"

build_linux:
docker:
Expand Down Expand Up @@ -218,16 +222,16 @@ jobs:

- run:
name: Create linux bundle
command: ./build-linux.sh && tar -zcvf "filecoin-linux.tar.gz" filecoin && ls -al
command: ./scripts/build-bundle.sh
- store_artifacts:
path: "/go/src/github.com/filecoin-project/go-filecoin/filecoin-linux.tar.gz"
destination: filecoin-linux.tar.gz
path: "/go/src/github.com/filecoin-project/go-filecoin/filecoin-Linux.tar.gz"
destination: filecoin-Linux.tar.gz
- store_test_results:
path: test-results
- persist_to_workspace:
root: "."
paths:
- "filecoin-linux.tar.gz"
- "filecoin-Linux.tar.gz"

publish_release:
docker:
Expand All @@ -239,12 +243,15 @@ jobs:
- "1e:73:c5:15:75:e0:e4:98:54:3c:2b:9e:e8:94:14:2e"
- setup_remote_docker:
docker_layer_caching: true
- checkout
- attach_workspace:
at: "."
- run:
name: list linux bundle
name: list bundle
command: |
ls -al filecoin-*.tar.gz
ls -al
./scripts/publish-release.sh
build_docker_img:
docker:
Expand Down Expand Up @@ -346,6 +353,7 @@ workflows:
- publish_release:
requires:
- build_linux
- build_macos
filters:
branches:
only:
Expand Down
26 changes: 0 additions & 26 deletions build-macos.sh

This file was deleted.

3 changes: 3 additions & 0 deletions build-linux.sh → scripts/build-bundle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ mkdir filecoin/fixtures
cp fixtures/*.key filecoin/fixtures/
cp fixtures/*.car filecoin/fixtures/
cp fixtures/*.json filecoin/fixtures/


tar -zcvf "filecoin-`uname`.tar.gz" filecoin
56 changes: 56 additions & 0 deletions scripts/publish-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/usr/bin/env bash

RELEASE_TAG="${CIRCLE_SHA1:0:16}"

# make sure we have a token set, api requests won't work otherwise
if [ -z $GITHUB_TOKEN ]; then
echo "\$GITHUB_TOKEN not set, publish failed"
exit 1
fi

#see if the release already exists by tag
RELEASE_RESPONSE=`
curl \
--header "Authorization: token $GITHUB_TOKEN" \
"https://api.github.com/repos/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/releases/tags/$RELEASE_TAG"
`
RELEASE_ID=`echo $RELEASE_RESPONSE | jq '.id'`

if [ "$RELEASE_ID" = "null" ]; then
echo "creating release"

RELEASE_DATA="{
\"tag_name\": \"$RELEASE_TAG\",
\"target_commitish\": \"$CIRCLE_SHA1\",
\"name\": \"$RELEASE_TAG\",
\"body\": \"\"
}"

# create it if it doesn't exist yet
RELEASE_RESPONSE=`
curl \
--request POST \
--header "Authorization: token $GITHUB_TOKEN" \
--header "Content-Type: application/json" \
--data "$RELEASE_DATA" \
"https://api.github.com/repos/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/releases"
`
else
echo "release already exists"
fi

RELEASE_UPLOAD_URL=`echo $RELEASE_RESPONSE | jq -r '.upload_url' | cut -d'{' -f1`

bundles=('filecoin-Linux.tar.gz' 'filecoin-Darwin.tar.gz')
for RELEASE_FILE in "${bundles[@]}"
do
echo "Uploading release bundle: $RELEASE_FILE"
curl \
--request POST \
--header "Authorization: token $GITHUB_TOKEN" \
--header "Content-Type: application/octet-stream" \
--data-binary "@$RELEASE_FILE" \
"$RELEASE_UPLOAD_URL?name=$(basename $RELEASE_FILE)"

echo "Release bundle uploaded: $RELEASE_FILE "
done

0 comments on commit a4c7af8

Please sign in to comment.