Skip to content

Commit

Permalink
copy to latest after release
Browse files Browse the repository at this point in the history
  • Loading branch information
ianic committed Nov 19, 2021
1 parent d200a4d commit 2d83467
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 1 deletion.
1 change: 1 addition & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ archives:
windows: Windows
386: i386
amd64: x86_64
files: # remove README to go into archive (that is default: https://goreleaser.com/customization/archive/?h=readme)
checksum:
name_template: 'checksums.txt'
snapshot:
Expand Down
9 changes: 8 additions & 1 deletion cli/controller/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,18 @@ func runTests(projectPath, apiURL, runRegexp string) error {
if runRegexp != "" {
args = append(args, "--run", runRegexp)
}
return shell.Exec(shell.ExecOptions{
err := shell.Exec(shell.ExecOptions{
Env: []string{fmt.Sprintf("%s=%s", domain.EnvApiURL, apiURL)},
Args: args,
WorkDir: projectPath + "/test",
Logger: ui.Info,
ShowShellCmd: false,
ShowExitCode: false,
})
if err == nil {
ui.Notice("PASS")
} else {
ui.ErrorLine("FAIL")
}
return nil
}
30 changes: 30 additions & 0 deletions scripts/copy_release_to_latest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash

git_tag=$(git describe --always)
tag="${1:-$git_tag}"

version="${tag:1}" # tag without leading v
bucket=s3://releases.mantil.io

function do-copy() {
os=$1
arch=$2
from="$bucket"/"$tag"/mantil_"$version"_"$os"_"$arch".tar.gz
to="$bucket"/latest/mantil_"$os"_"$arch".tar.gz
#echo $from $to
aws s3 cp "$from" "$to"
}

for arch in x86_64 arm64; do
do-copy Darwin $arch
done

for arch in x86_64 i386; do
do-copy Windows $arch
done


for arch in x86_64 i386 arm arm64; do
do-copy Linux $arch
done

6 changes: 6 additions & 0 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#
# Flags:
# --only-cli just builds cli
# --silent don't send slack notification

GIT_ROOT=$(git rev-parse --show-toplevel)

Expand All @@ -33,6 +34,7 @@ if [ -n "$RELEASE" ]; then
echo "> Releasing new cli version to homebrew"
cd "$GIT_ROOT"
(export tag=$tag dev=$USER on_tag=$on_tag; goreleaser release --rm-dist)
script/copy_release_to_latest.sh $tag
fi

deploy_function() {
Expand All @@ -52,6 +54,10 @@ for d in $GIT_ROOT/node/functions/*; do
(cd $d && deploy_function $func_name)
done

if [[ $* == *--silent* ]]; then
exit 0
fi

# slack notification for new published version
if [ -n "$RELEASE" ]; then
curl -X POST -H 'Content-type: application/json' --data '{"text":"Mantil version '$tag' is released!"}' https://hooks.slack.com/services/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
Expand Down

0 comments on commit 2d83467

Please sign in to comment.