Skip to content

Fix release workflow by using Makefile target for consistent builds#868

Merged
mattisonchao merged 5 commits intomainfrom
copilot/fix-release-workflow-issue
Jan 19, 2026
Merged

Fix release workflow by using Makefile target for consistent builds#868
mattisonchao merged 5 commits intomainfrom
copilot/fix-release-workflow-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 19, 2026

The release workflow introduced in #866 fails during binary compilation with directory not found error. The build command references ./cmd/oxia, but the repository structure has the main package at ./cmd. Additionally, the workflow was missing important build flags that are used in the Makefile.

Changes

  • Fixed build path: Updated from ./cmd/oxia to ./cmd to match the repository structure
  • Created new Makefile target: Added release-build target that encapsulates all release build logic with parameters:
    • OUTPUT_DIR: Directory for build output
    • OUTPUT_NAME: Name of the output binary
    • GOOS: Target operating system
    • GOARCH: Target architecture
  • Parameter validation: Added validation to the Makefile target to ensure all required parameters are provided with helpful error messages
  • Updated workflow: Changed the workflow to use make release-build instead of direct go build commands

The release-build target includes the same build flags as the standard build target:

  • -tags disable_trap: Disables trap functionality for production builds
  • -ldflags "-X main.version=${VERSION}": Embeds version information into the binary
  • -v: Enables verbose output
  • Version extraction using git describe --tags --always | cut -c2-
# Before
go build -o dist/oxia/bin/oxia${{ matrix.suffix }} ./cmd/oxia

# After  
make release-build \
  OUTPUT_DIR=dist/oxia \
  OUTPUT_NAME=oxia${{ matrix.suffix }} \
  GOOS=${{ matrix.goos }} \
  GOARCH=${{ matrix.goarch }}

Benefits

  • Centralized build logic: All build flags are maintained in the Makefile, not duplicated in the workflow
  • Automatic updates: Future changes to build flags will automatically apply to the release workflow
  • Consistency: Ensures local builds and CI builds use identical configuration
  • Maintainability: Single source of truth for build configuration reduces maintenance burden

This enables the workflow to build cross-platform binaries (linux/darwin/windows, amd64/arm64) successfully with proper version information and build configuration that stays in sync with the project's Makefile.

Original prompt

This section details on the original issue you should resolve

<issue_title>fixes: release workflow</issue_title>
<issue_description>### Motivation

#866 introduced a new release workflow. please check the action and try to fix it.</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: mattisonchao <74767115+mattisonchao@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix release workflow in GitHub Actions Fix release workflow build path Jan 19, 2026
Copilot AI requested a review from mattisonchao January 19, 2026 17:16
@mattisonchao mattisonchao marked this pull request as ready for review January 19, 2026 17:28
@mattisonchao
Copy link
Copy Markdown
Member

Hi @copilot

why not use make build directly?

Co-authored-by: mattisonchao <74767115+mattisonchao@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jan 19, 2026

Hi @copilot

why not use make build directly?

You're right! I've updated the workflow to include the build flags from the Makefile (-tags disable_trap, -ldflags "-X main.version=${VERSION}", and -v). The workflow needs a custom output path for the dist structure, but now it uses the same build configuration as make build. See commit cceb84f.

Copilot AI changed the title Fix release workflow build path Fix release workflow build path and add build flags Jan 19, 2026
@mattisonchao
Copy link
Copy Markdown
Member

@copilot
Is it possible to merge this command into the makefile? that can avoid new flag missing add in the workflow. IIRC, we have an distribution script in makefile?

Co-authored-by: mattisonchao <74767115+mattisonchao@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jan 19, 2026

@copilot
Is it possible to merge this command into the makefile? that can avoid new flag missing add in the workflow. IIRC, we have an distribution script in makefile?

Great suggestion! I've created a new release-build target in the Makefile that encapsulates all the build logic. The workflow now calls make release-build with parameters, which ensures future build flag changes in the Makefile will automatically be reflected in the release workflow. See commit ea4ef47.

Co-authored-by: mattisonchao <74767115+mattisonchao@users.noreply.github.com>
Copilot AI changed the title Fix release workflow build path and add build flags Fix release workflow by using Makefile target for consistent builds Jan 19, 2026
@mattisonchao mattisonchao merged commit 23dcbf5 into main Jan 19, 2026
4 checks passed
@mattisonchao mattisonchao deleted the copilot/fix-release-workflow-issue branch January 19, 2026 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fixes: release workflow

2 participants