Skip to content

Commit

Permalink
build: improve release script to create tarball directly (#429)
Browse files Browse the repository at this point in the history
Improves the release script to create the tarball directly. This
makes it easier to cut new releases as a few manual steps are
now automated. This change also includes some fallback logic
for finding Copybara for Googlers (like it was done previously),
and no longer relies on a release directory to be specified as `$1`
argument to the Bash script.
  • Loading branch information
devversion authored Sep 17, 2021
1 parent 6b2ef24 commit 7195c73
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ bazel-*
user.bazelrc

.idea/
dist/
2 changes: 1 addition & 1 deletion tools/copy.bara.sky
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ core.workflow(
"bazel-bin/go/wsl/main/main_*",
"bazel-bin/go/wtl/main/main_*",
],
exclude = ["go/metadata/main/**", "**/*.runfiles_manifest"],
exclude = [".bazelrc", "go/metadata/main/**", "**/*.runfiles_manifest"],
),
transformations = [
core.move("bazel-bin/go/metadata/main", "go/metadata/main"),
Expand Down
28 changes: 27 additions & 1 deletion tools/releaser.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,17 @@

# Shell script for creating a release directory.

copybaraBin=$(which copybara)

# If Copybara is not available in the `PATH`, we try using Copybara
# from a path where it is supposed to exist (Googlers-only).
if [[ -z "${copybaraBin}" ]]; then
copybaraBin=/google/data/ro/teams/copybara/copybara
fi

cd "$(dirname $0)/.."
pwd

bazel build -c opt --stamp \
--platforms=@io_bazel_rules_go//go/toolchain:darwin_amd64 \
//go/metadata/main \
Expand All @@ -40,4 +51,19 @@ bazel build -c opt --stamp \
//go/wsl/main \
//go/wtl/main

copybara --folder-dir="$1" migrate tools/copy.bara.sky release .
tmpDir="$PWD/dist"
outputDir="${tmpDir}/release-artifact"
archiveDir="${tmpDir}/rules_webtesting.tar.gz"

# Create a temporary directory for storing the release artifacts.
rm -Rf ${tmpDir}
mkdir -p ${tmpDir}

# Build the release artifact directory using the Copybara `release` workflow.
${copybaraBin} --folder-dir="${outputDir}" migrate tools/copy.bara.sky "release" $PWD

# Create the release output tarball.
tar -cvzf ${archiveDir} -C ${outputDir} .

echo "Release tarball has been stored in: ${archiveDir}"
echo "Attach this tarball to the Github release entry."

0 comments on commit 7195c73

Please sign in to comment.