[update] go buildに-trimpathを追加 #11
Workflow file for this run
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
name: Build and Release | |
on: | |
workflow_dispatch: | |
push: | |
tags: | |
- 'v*' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
os: [linux, windows, darwin] | |
arch: [amd64, arm64] | |
env: | |
OUTPUT_FILE: namagent-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.os == 'windows' && '.exe' || '' }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.23' | |
check-latest: true | |
cache-dependency-path: go.sum | |
- name: Build | |
run: | | |
export GOARCH=${{ matrix.arch }} | |
export GOOS=${{ matrix.os }} | |
export CGO_ENABLED=0 | |
go build -ldflags="-s -w" -trimpath -o ${{ env.OUTPUT_FILE }} | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-${{ matrix.os }}-${{ matrix.arch }} | |
path: ${{ env.OUTPUT_FILE }} | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: dist | |
pattern: build-* | |
merge-multiple: true | |
- name: Create GitHub Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: dist/* | |
tag_name: ${{ github.ref_name }} | |
name: ${{ github.ref_name }} | |
draft: false | |
prerelease: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |