diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d2a46d4..aa15ea8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,8 +7,8 @@ on: - "*" jobs: - build-and-release: - name: Build and Release + build-and-release-linux: + name: Build and Release Linux Binaries runs-on: ubuntu-latest steps: @@ -19,29 +19,65 @@ jobs: uses: actions/setup-go@v5 with: go-version: 1.22.3 - - - name: Install goreleaser - run: | - curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | sh -s -- -b $(go env GOPATH)/bin v2.0.1 - - name: Install syft + - name: Install dependencies run: | + sudo apt-get update -y + sudo apt-get install -y gcc-aarch64-linux-gnu curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin - - name: Clean modcache - run: | - make go-clean + - name: Cache Go modules + uses: actions/cache@v3 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- - - name: Build binary + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v6 + with: + distribution: goreleaser + version: "v2.1.0" + args: release --clean --parallelism=1 --config=.goreleaser-linux.yml + env: + GITHUB_TOKEN: ${{ secrets.GH_PAT }} + + build-and-release-darwin: + name: Build and Release Darwin Binaries + runs-on: macos-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: 1.22.3 + + - name: Install dependencies run: | - make build + brew install coreutils + curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin + + - name: Cache Go modules + uses: actions/cache@v3 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- - name: Run GoReleaser uses: goreleaser/goreleaser-action@v6 with: distribution: goreleaser version: "v2.0.1" - args: release --clean + args: release --clean --parallelism=1 --config=.goreleaser-darwin.yml env: GITHUB_TOKEN: ${{ secrets.GH_PAT }} - diff --git a/.goreleaser-darwin.yml b/.goreleaser-darwin.yml new file mode 100644 index 0000000..f963274 --- /dev/null +++ b/.goreleaser-darwin.yml @@ -0,0 +1,41 @@ +version: 2 + +project_name: flux-graph +builds: + - id: darwin + env: + - CGO_ENABLED=1 + goos: + - darwin + goarch: + - amd64 + - arm64 + flags: + - -trimpath + ldflags: + - -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{ .CommitDate }} -X main.builtBy=goreleaser -X main.treeState={{ .IsGitDirty }} + +checksum: + name_template: "checksums_{{ .Os }}_{{ .Arch }}.txt" + +archives: + - name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" + format_overrides: + - goos: windows + format: zip + builds_info: + group: root + owner: root + mode: 0644 + mtime: 2008-01-02T15:04:05Z + files: + - README.md + - LICENSE + +sboms: + - artifacts: archive + +release: + github: + owner: rishinair11 + name: flux-graph \ No newline at end of file diff --git a/.goreleaser-linux.yml b/.goreleaser-linux.yml new file mode 100644 index 0000000..b925863 --- /dev/null +++ b/.goreleaser-linux.yml @@ -0,0 +1,45 @@ +version: 2 + +project_name: flux-graph +builds: + - id: linux + env: + - CGO_ENABLED=1 + - >- + {{- if eq .Os "linux" }} + {{- if eq .Arch "arm64"}}CC=aarch64-linux-gnu-gcc{{- end }} + {{- end }} + goos: + - linux + goarch: + - amd64 + - arm64 + flags: + - -trimpath + ldflags: + - -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{ .CommitDate }} -X main.builtBy=goreleaser -X main.treeState={{ .IsGitDirty }} + +checksum: + name_template: "checksums_{{ .Os }}_{{ .Arch }}.txt" + +archives: + - name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" + format_overrides: + - goos: windows + format: zip + builds_info: + group: root + owner: root + mode: 0644 + mtime: 2008-01-02T15:04:05Z + files: + - README.md + - LICENSE + +sboms: + - artifacts: archive + +release: + github: + owner: rishinair11 + name: flux-graph \ No newline at end of file diff --git a/.goreleaser.yml b/.goreleaser.yml deleted file mode 100644 index fc15884..0000000 --- a/.goreleaser.yml +++ /dev/null @@ -1,92 +0,0 @@ -version: 2 - -project_name: flux-graph -builds: - - env: - - CGO_ENABLED=1 - - >- - {{- if eq .Os "darwin" }} - {{- if eq .Arch "amd64"}}CC=o64-clang{{- end }} - {{- if eq .Arch "arm64"}}CC=aarch64-apple-darwin20.2-clang{{- end }} - {{- end }} - {{- if eq .Os "windows" }} - {{- if eq .Arch "amd64" }}CC=x86_64-w64-mingw32-gcc{{- end }} - {{- end }} - {{- if eq .Os "linux" }} - {{- if eq .Arch "arm64" }}CC=aarch64-linux-gnu-gcc{{- end }} - {{- if eq .Arch "arm64" }}CC=x86_64-linux-gnu-gcc{{- end }} - {{- end }} - goos: - - linux - - windows - - darwin - goarch: - - amd64 - - arm64 - ignore: - - goos: windows - goarch: arm64 - mod_timestamp: "{{ .CommitTimestamp }}" - flags: - - -trimpath - ldflags: - - -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{ .CommitDate }} -X main.builtBy=goreleaser -X main.treeState={{ .IsGitDirty }} - -checksum: - name_template: "checksums.txt" - -changelog: - sort: asc - use: github - filters: - exclude: - - "^test:" - - "^test\\(" - - "merge conflict" - - Merge pull request - - Merge remote-tracking branch - - Merge branch - - go mod tidy - groups: - - title: Dependency updates - regexp: '^.*?(.+)\(deps\)!?:.+$' - order: 300 - - title: "New Features" - regexp: '^.*?feat(\(.+\))??!?:.+$' - order: 100 - - title: "Security updates" - regexp: '^.*?sec(\(.+\))??!?:.+$' - order: 150 - - title: "Bug fixes" - regexp: '^.*?(fix|refactor)(\(.+\))??!?:.+$' - order: 200 - - title: "Documentation updates" - regexp: ^.*?docs?(\(.+\))??!?:.+$ - order: 400 - - title: "Build process updates" - regexp: ^.*?(build|ci)(\(.+\))??!?:.+$ - order: 400 - - title: Other work - order: 9999 - -archives: - - name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" - format_overrides: - - goos: windows - format: zip - builds_info: - group: root - owner: root - mode: 0644 - mtime: 2008-01-02T15:04:05Z - files: - - README.md - - LICENSE - -sboms: - - artifacts: archive - -release: - github: - owner: rishinair11 - name: flux-graph \ No newline at end of file