Skip to content

Commit 6b97eea

Browse files
Build release (#15)
1 parent af1d916 commit 6b97eea

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Release
2+
3+
on:
4+
release:
5+
# Runs when you publish a release in GitHub (draft -> published, or a new
6+
# published release). The release already exists, so we just attach binaries.
7+
types: [published]
8+
9+
permissions:
10+
contents: write # needed to upload release assets
11+
12+
jobs:
13+
release:
14+
name: Build & attach binaries
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v6
18+
- uses: actions/setup-go@v5
19+
with:
20+
go-version-file: go.mod
21+
22+
- name: Build all targets
23+
run: |
24+
mkdir -p dist
25+
# Windows-on-ARM runs x64 under emulation, so one Windows build suffices.
26+
for target in linux/amd64 linux/arm64 darwin/amd64 darwin/arm64 windows/amd64; do
27+
os="${target%/*}"; arch="${target#*/}"
28+
ext=""; [ "$os" = "windows" ] && ext=".exe"
29+
out="dist/php-debugger-${os}-${arch}${ext}"
30+
echo "building $out"
31+
CGO_ENABLED=0 GOOS="$os" GOARCH="$arch" \
32+
go build -trimpath -ldflags "-s -w" -o "$out" .
33+
done
34+
ls -la dist
35+
36+
- name: Attach binaries to the release
37+
env:
38+
GH_TOKEN: ${{ github.token }}
39+
TAG: ${{ github.event.release.tag_name }}
40+
run: gh release upload "$TAG" dist/* --clobber

0 commit comments

Comments
 (0)