From 3d7a7ff0b8ba57ec2dbd0c86656faaf63c1d43c1 Mon Sep 17 00:00:00 2001 From: Filippo Valsorda Date: Fri, 10 Sep 2021 12:09:00 +0200 Subject: [PATCH] .github/workflows: add -trimpath to build and refactor a bit --- .github/workflows/build.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f739f3a..8002d0e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,14 +21,15 @@ jobs: fetch-depth: 0 - name: Build binaries run: | - VERSION=$(git describe --tags) + cp LICENSE "$RUNNER_TEMP/LICENSE" + echo -e "\n---\n" >> "$RUNNER_TEMP/LICENSE" + curl "https://golang.org/LICENSE?m=text" >> "$RUNNER_TEMP/LICENSE" + VERSION="$(git describe --tags)" function build_age() { DIR="$(mktemp -d)" mkdir "$DIR/age" - cp LICENSE "$DIR/age" - echo -e "\n---\n" >> "$DIR/age/LICENSE" - curl "https://golang.org/LICENSE?m=text" >> "$DIR/age/LICENSE" - go build -o "$DIR/age" -ldflags "-X main.Version=$VERSION" ./cmd/... + cp "$RUNNER_TEMP/LICENSE" "$DIR/age" + go build -o "$DIR/age" -ldflags "-X main.Version=$VERSION" -trimpath ./cmd/... if [ "$GOOS" == "windows" ]; then ( cd "$DIR"; zip age.zip -r age ) mv "$DIR/age.zip" "age-$VERSION-$GOOS-$GOARCH.zip"