-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Port Go-Releaser changes to
master
(#1440)
* Switch to goreleaser & add support for CGO cross-compilation (#1423) * Restore Windows Release (#1431) * Add `v` prefix back to build assets (#1434)
- Loading branch information
Showing
6 changed files
with
110 additions
and
36 deletions.
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 |
---|---|---|
|
@@ -5,18 +5,13 @@ on: | |
types: [published] | ||
|
||
jobs: | ||
releases-matrix: | ||
release: | ||
name: Release Go Binary | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
# build and publish in parallel: linux/386, linux/amd64, linux/arm64, windows/386, windows/amd64, darwin/amd64, darwin/arm64 | ||
goos: [ linux, windows, darwin ] | ||
goarch: [ amd64, arm64 ] | ||
exclude: | ||
- goarch: arm64 | ||
goos: windows | ||
steps: | ||
# See https://github.com/onflow/flow-cli/pull/1431 for more information | ||
- name: Delete unnecessary cache | ||
run: rm -rf ${RUNNER_TOOL_CACHE} | ||
- uses: actions/checkout@v3 | ||
- name: Codebase security check | ||
continue-on-error: true | ||
|
@@ -25,19 +20,14 @@ jobs: | |
go-version: '1.20' | ||
env: | ||
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} | ||
- uses: wangyoucao577/[email protected] | ||
env: | ||
MIXPANEL_PROJECT_TOKEN: ${{ secrets.MIXPANEL_PROJECT_TOKEN }} | ||
LILICO_TOKEN: ${{ secrets.LILICO_TOKEN }} | ||
APP_VERSION: $(basename ${GITHUB_REF}) | ||
BUILD_TIME: $(date --iso-8601=seconds) | ||
VERSION: ${{github.ref_name}} | ||
COMMIT: ${{ github.sha }} | ||
with: | ||
pre_command: make generate | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
goos: ${{ matrix.goos }} | ||
goarch: ${{ matrix.goarch }} | ||
goversion: "1.20" | ||
project_path: "./cmd/flow" | ||
ldflags: -X "github.com/onflow/flow-cli/build.commit=${{ env.COMMIT }}" -X "github.com/onflow/flow-cli/build.semver=${{ env.VERSION }}" -X "github.com/onflow/flow-cli/internal/command.mixpanelToken=${{ env.MIXPANEL_PROJECT_TOKEN }}" -X "github.com/onflow/flow-cli/internal/accounts.accountToken=${{ env.LILICO_TOKEN }}" | ||
- name: Setup Release Environment | ||
run: |- | ||
echo 'MIXPANEL_PROJECT_TOKEN=${{ secrets.MIXPANEL_PROJECT_TOKEN }}' > .release-env | ||
echo 'LILICO_TOKEN=${{ secrets.LILICO_TOKEN }}' >> .release-env | ||
echo 'APP_VERSION=$(basename ${GITHUB_REF})' >> .release-env | ||
echo 'BUILD_TIME=$(date --iso-8601=seconds)' >> .release-env | ||
echo 'VERSION=${{ github.ref_name }}' >> .release-env | ||
echo 'COMMIT=${{ github.sha }}' >> .release-env | ||
echo 'GITHUB_TOKEN=${{ secrets.FLOW_CLI_RELEASE }}' >> .release-env | ||
- name: Build and Release | ||
run: make release |
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 |
---|---|---|
|
@@ -31,4 +31,7 @@ main | |
*.pkey | ||
|
||
# Local development file generation folder | ||
imports | ||
imports | ||
|
||
# Goreleaser .env | ||
.release-env |
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 @@ | ||
before: | ||
hooks: | ||
- make generate | ||
|
||
builds: | ||
- id: flow-cli | ||
main: ./cmd/flow | ||
goos: | ||
- darwin | ||
- linux | ||
- windows | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
env: | ||
- CGO_FLAGS="-O2 -D__BLST_PORTABLE__" | ||
- CGO_ENABLED=1 | ||
- CC_darwin_amd64=o64-clang | ||
- CXX_darwin_amd64=o64-clang+ | ||
- CC_darwin_arm64=oa64-clang | ||
- CXX_darwin_arm64=oa64-clang++ | ||
- CC_linux_amd64=x86_64-linux-gnu-gcc | ||
- CXX_linux_amd64=x86_64-linux-gnu-g++ | ||
- CC_linux_arm64=aarch64-linux-gnu-gcc | ||
- CXX_linux_arm64=aarch64-linux-gnu-g++ | ||
- CC_windows_amd64=x86_64-w64-mingw32-gcc | ||
- CXX_windows_amd64=x86_64-w64-mingw32-g++ | ||
- CC_windows_arm64=/llvm-mingw/bin/aarch64-w64-mingw32-gcc | ||
- CXX_windows_arm64=/llvm-mingw/bin/aarch64-w64-mingw32-g++ | ||
- 'CC={{ index .Env (print "CC_" .Os "_" .Arch) }}' | ||
- 'CXX={{ index .Env (print "CXX_" .Os "_" .Arch) }}' | ||
flags: | ||
- -mod=readonly | ||
ldflags: | ||
- -X github.com/onflow/flow-cli/build.commit={{ .Env.COMMIT }} -X github.com/onflow/flow-cli/build.semver={{ .Env.VERSION }} -X github.com/onflow/flow-cli/internal/command.mixpanelToken={{ .Env.MIXPANEL_PROJECT_TOKEN }} -X github.com/onflow/flow-cli/internal/accounts.accountToken={{ .Env.LILICO_TOKEN }} | ||
|
||
archives: | ||
- id: golang-cross | ||
builds: | ||
- flow-cli | ||
name_template: "{{ .ProjectName }}-v{{ .Version }}-{{ .Os }}-{{ .Arch }}" | ||
format: tar.gz | ||
wrap_in_directory: false | ||
snapshot: | ||
name_template: "{{ .Tag }}" | ||
changelog: | ||
skip: true | ||
checksum: | ||
name_template: "checksums.txt" | ||
release: | ||
github: | ||
owner: onflow | ||
name: flow-cli | ||
prerelease: auto | ||
draft: false |
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
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
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