Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

Commit

Permalink
Merge pull request #114 from hashicorp/main
Browse files Browse the repository at this point in the history
Main merge to release/0.1.x
  • Loading branch information
Andrew Stucki authored Feb 23, 2022
2 parents ee107fb + fbefd5b commit 1f408bc
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,25 @@ jobs:
name: metadata.json
path: ${{ steps.generate-metadata-file.outputs.filepath }}

build:
set-ld-flags:
needs: get-product-version
runs-on: ubuntu-latest
outputs:
ldflags: ${{ steps.generate-ld-flags.outputs.ldflags }}
steps:
- uses: actions/checkout@v2
- name: 'Generate ld flags'
id: generate-ld-flags
run: |
project="$(go list -m)"
sha="$(git rev-parse --short HEAD)"
echo "::set-output name=ldflags::"-s -w -X \'$project/internal/version.Name=${{ env.PKG_NAME }}\' \
-X \'$project/internal/version.GitCommit=$sha\' \
-X \'$project/internal/version.GitDescribe=v$(make version base=1)\'""
build:
needs: [get-product-version, set-ld-flags]
runs-on: ubuntu-latest
strategy:
matrix:
goos: ["linux"]
Expand All @@ -54,6 +70,7 @@ jobs:
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
LD_FLAGS: ${{ needs.set-ld-flags.outputs.ldflags }}

steps:
- uses: actions/checkout@v2
Expand All @@ -64,7 +81,7 @@ jobs:
- name: Build
run: |
mkdir dist out
go build -o dist/
go build -ldflags "${{ env.LD_FLAGS }}" -o dist/
zip -r -j out/${{ env.PKG_NAME }}_${{ needs.get-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip dist/
- uses: actions/upload-artifact@v2
with:
Expand Down

0 comments on commit 1f408bc

Please sign in to comment.