Skip to content
8 changes: 4 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ commands:
- run:
name: Output BUILD_VERSION env var based on recent git tag and type of build
command: |
BUILD_VERSION=$(git describe --tags --match 'v*.*.*' --exclude '*feature');
BUILD_VERSION=$(git describe --tags --match 'v*.*.*');
echo "git tag-based BUILD_VERSION: $BUILD_VERSION"
if [[ "<< parameters.release_ref >>" =~ ^v[0-9]+\.[0-9]+\.[0-9]+ ]]; then
# if release tag starts with semver, then this is either a prod or feature build. use the release tag, then, as build version too.
Expand Down Expand Up @@ -152,7 +152,7 @@ jobs:
name: Run GoReleaser. Without actually publishing.
command: |
export LDFLAGS="-s -w -X 'github.com/slackapi/slack-cli/internal/pkg/version.Version=$BUILD_VERSION'"
make build-snapshot
make LDFLAGS="$LDFLAGS" build-snapshot
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The -s and -w flag weren't being used when building the snapshot! I'm hoping this improves our runtime speeds around 👾

Before:

$ du dist/*
...
13324   dist/slack_cli_3.0.2-main-build-test-feature-6-gcc496f3_linux_64-bit.tar.gz
13332   dist/slack_cli_3.0.2-main-build-test-feature-6-gcc496f3_macOS_64-bit.tar.gz
14376   dist/slack_cli_3.0.2-main-build-test-feature-6-gcc496f3_windows_64-bit.zip

After:

$ du dist/*
...
7156    dist/slack_cli_3.0.2-main-build-test-feature-6-gcc496f3_linux_64-bit.tar.gz
7252    dist/slack_cli_3.0.2-main-build-test-feature-6-gcc496f3_macOS_64-bit.tar.gz
7208    dist/slack_cli_3.0.2-main-build-test-feature-6-gcc496f3_windows_64-bit.zip

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch @zimeg! 👏🏻 Before this change, the export LDFLAGS was unused and instead it was using the LDFLAGS set by Makefile's startup.

- run:
name: Show binaries are generated correctly
command: ls -R ./dist
Expand Down Expand Up @@ -313,10 +313,10 @@ jobs:
echo "Overwriting existing GitHub Release data; generating pre-release notes ..."
LAST_SEMVER_TAG=$(git describe --tags --match 'v*.*.*' --abbrev=0 | cut -d"-" -f1)
# When generating release notes, setting the target tag_name property to an existing tag has GitHub ignore the target_commitish property
# So, set it to some non-existent tag name for release-note-generating purposes.
# So, set the tag to the commit hash for release-note-generating purposes.
# See https://docs.github.com/en/rest/releases/releases?apiVersion=2022-11-28#generate-release-notes-content-for-a-release--parameters
# Note the following _does not change releases or tags_ - it only creates release notes, just like clicking "Generate Release Notes" on the GitHub Releases page.
CHANGELOG=$(curl -L -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $GITHUB_RELEASE_TOKEN" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/slackapi/slack-cli/releases/generate-notes -d "{\"tag_name\":\"does-not-exist\",\"target_commitish\":\"${TARGET}\",\"previous_tag_name\":\"${LAST_SEMVER_TAG}\"}" | jq .body)
CHANGELOG=$(curl -L -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $GITHUB_RELEASE_TOKEN" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/slackapi/slack-cli/releases/generate-notes -d "{\"tag_name\":\"${TARGET}\",\"target_commitish\":\"${TARGET}\",\"previous_tag_name\":\"${LAST_SEMVER_TAG}\"}" | jq .body)
echo "Will use release notes: ${CHANGELOG}"
BODY+="\"body\":$CHANGELOG}"
echo "Updating existing GitHub pre-release ${RELEASE_ID} with ${BODY}"
Expand Down
2 changes: 1 addition & 1 deletion scripts/archive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -eo

# USAGE:
# ./scripts/archive.sh <artifact path> <release version>
Expand Down
Loading