Release #2
Workflow file for this run
This file contains hidden or 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: Release | |
| on: | |
| release: | |
| # Runs when you publish a release in GitHub (draft -> published, or a new | |
| # published release). The release already exists, so we just attach binaries. | |
| types: [published] | |
| permissions: | |
| contents: write # needed to upload release assets | |
| jobs: | |
| release: | |
| name: Build & attach binaries | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| - name: Build and package all targets | |
| run: | | |
| mkdir -p dist build | |
| # Windows-on-ARM runs x64 under emulation, so one Windows build suffices. | |
| for target in linux/amd64 linux/arm64 darwin/amd64 darwin/arm64 windows/amd64; do | |
| goos="${target%/*}"; arch="${target#*/}" | |
| # Asset OS name: darwin -> macos. | |
| osname="$goos"; [ "$goos" = "darwin" ] && osname="macos" | |
| bin="php-debugger"; [ "$goos" = "windows" ] && bin="php-debugger.exe" | |
| echo "building $osname/$arch" | |
| CGO_ENABLED=0 GOOS="$goos" GOARCH="$arch" \ | |
| go build -trimpath -ldflags "-s -w" -o "build/$bin" . | |
| chmod +x "build/$bin" | |
| # Package into an archive so the executable bit survives download | |
| # (raw GitHub release assets lose Unix permissions). | |
| base="php-debugger-${osname}-${arch}" | |
| if [ "$goos" = "windows" ]; then | |
| (cd build && zip -q "../dist/${base}.zip" "$bin") | |
| else | |
| tar -C build -czf "dist/${base}.tar.gz" "$bin" | |
| fi | |
| rm -f "build/$bin" | |
| done | |
| ls -la dist | |
| - name: Attach binaries to the release | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| TAG: ${{ github.event.release.tag_name }} | |
| run: gh release upload "$TAG" dist/* --clobber |