-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: upload built binary assets to new releases
- Loading branch information
Showing
2 changed files
with
56 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: Build and upload assets (test) | ||
on: | ||
release: | ||
types: [published] | ||
#push: | ||
|
||
jobs: | ||
build: | ||
name: Build and push binaries | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
arch: | ||
- amd64 | ||
- arm64 | ||
os: | ||
- linux | ||
steps: | ||
- | ||
name: Configure environment | ||
id: setup | ||
run: | | ||
if [[ '${{ github.event_name }}' = 'published' ]] | ||
then | ||
echo 'git_ref=${{ github.ref }}' >> $GITHUB_OUTPUT | ||
#else | ||
# echo 'git_ref=${{ github.sha }}' >> $GITHUB_OUTPUT | ||
fi | ||
- | ||
name: Checkout | ||
uses: actions/[email protected] | ||
with: | ||
ref: ${{ steps.setup.outputs.git_ref }} | ||
- | ||
name: Setup Go | ||
uses: actions/[email protected] | ||
with: | ||
go-version-file: 'go.mod' | ||
- | ||
name: Build and upload | ||
env: | ||
GOOS: ${{ matrix.os }} | ||
GOARCH: ${{ matrix.arch }} | ||
VERSION: ${{ steps.setup.outputs.git_ref }} | ||
run: | | ||
LD_FLAGS="" | ||
LD_FLAGS+=" -s" # no debug symbols | ||
LD_FLAGS+=" -w" # no DWARF debug info | ||
LD_FLAGS+=" -X 'main.buildDate=$(date --utc +%Y-%m-%dT%H:%M:%SZ)'" | ||
LD_FLAGS+=" -X 'main.version=${VERSION}'" | ||
make LD_FLAGS="${LD_FLAGS}" build | ||
tar -cvzf terraform-registry.tar.gz terraform-registry | ||
gh release upload ${VERSION} terraform-registry.tar.gz%#%terraform-registry_${VERSION}_${GOOS}_${GOARCH}.tar.gz | ||
rm terraform-registry terraform-registry.tar.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters