From ee9e63ca40a4b27db4fce4fd3230ac8921c38a2a Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Thu, 21 Jul 2022 08:26:49 -0700 Subject: [PATCH 1/3] Setup go for release job --- .github/workflows/release.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0d5976015..a3dae9cec 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,10 +14,14 @@ jobs: steps: - name: Code Checkout uses: actions/checkout@v1 - - name: Set Ruby + - name: Setup Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: '2.6' + ruby-version: '2.7' + - name: Setup Go + uses: actions/setup-go@v3 + with: + go-version: '>=1.17.11' - name: Create Builders Release run: ./.ci/release.sh working-directory: ${{github.workspace}} From c736a528ca6ee846f53ebdf35613c0d41fbdbea9 Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Thu, 21 Jul 2022 08:27:25 -0700 Subject: [PATCH 2/3] Build go binary and include in release assets --- .ci/release.sh | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/.ci/release.sh b/.ci/release.sh index 1c1ce9fac..93c099d50 100755 --- a/.ci/release.sh +++ b/.ci/release.sh @@ -35,6 +35,23 @@ gem=$(printf "%s" "${g}") vagrant_version="$(gem specification "${gem}" version)" vagrant_version="${vagrant_version##*version: }" +# Build the go binary +wrap make \ + "Failed to build the Vagrant go binary" + +wrap mv vagrant vagrant-go \ + "Failed to rename Vagrant go binary" +wrap zip vagrant-go vagrant-go \ + "Failed to compress go binary" + +wrap mkdir release-assets \ + "Failed to create release assets directory" + +wrap mv vagrant*.gem release-assets \ + "Failed to move Vagrant RubyGem asset to release asset directory" +wrap mv vagrant-go.zip release-assets \ + "Failed to move Vagrant go asset to release asset directory" + # We want to release into the builders repository so # update the repository variable with the desired destination repo_owner="${target_owner}" @@ -46,7 +63,7 @@ export GITHUB_TOKEN="${HASHIBOT_TOKEN}" if [ "${tag}" = "" ]; then echo "Generating Vagrant RubyGem pre-release... " version="v${vagrant_version}+${short_sha}" - prerelease "${version}" "${gem}" + prerelease "${version}" ./release-assets else # Validate this is a proper release version valid_release_version "${vagrant_version}" @@ -56,7 +73,7 @@ else echo "Generating Vagrant RubyGem release... " version="v${vagrant_version}" - release "${version}" "${gem}" + release "${version}" ./release-assets fi slack -m "New Vagrant installers release triggered: *${version}*" From 62d16b3b9f1a178c22669a9cc6d00a99af9700d8 Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Tue, 26 Jul 2022 11:38:41 -0700 Subject: [PATCH 3/3] Build and store the binary on non-release builds --- .ci/build.sh | 10 ++++++++++ .github/workflows/build.yml | 10 +++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/.ci/build.sh b/.ci/build.sh index 349bafb77..df4f97502 100755 --- a/.ci/build.sh +++ b/.ci/build.sh @@ -16,5 +16,15 @@ wrap gem build *.gemspec \ g=(vagrant*.gem) gem=$(printf "%s" "${g}") +# Store the gem asset wrap aws s3 cp "${gem}" "${ASSETS_PRIVATE_BUCKET}/${repository}/vagrant-main.gem" \ "Failed to store Vagrant RubyGem main build" + +# Build our binary +wrap make \ + "Failed to build the Vagrant go binary" +wrap zip vagrant-go vagrant-go \ + "Failed to compress go binary" + +# Store the binary asset +wrap aws s3 cp vagrant-go.zip "${ASSETS_PRIVATE_BUCKET}/${repository}/vagrant-go-main.zip" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 02aa10aca..16955c4f3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,11 +14,15 @@ jobs: steps: - name: Code Checkout uses: actions/checkout@v1 - - name: Set Ruby + - name: Setup Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: '2.6' - - name: Build RubyGem + ruby-version: '2.7' + - name: Setup Go + uses: actions/setup-go@v3 + with: + go-version: '>=1.17.11' + - name: Build RubyGem and binary run: ./.ci/build.sh working-directory: ${{github.workspace}} env: