Skip to content

Commit 4c4b3f3

Browse files
committed
fix versioning on releases
Signed-off-by: Pau Escrich <p4u@dabax.net>
1 parent 1643659 commit 4c4b3f3

2 files changed

Lines changed: 16 additions & 5 deletions

File tree

.github/workflows/ci-release.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,11 @@ jobs:
5757
fetch-depth: 0
5858

5959
- name: Build Linux and Windows binaries (Docker cross toolchain)
60-
run: make release-docker-core VERSION=${{ github.ref_type == 'tag' && github.ref_name || github.sha }}
60+
run: |
61+
export VERSION="${{ github.ref_type == 'tag' && github.ref_name || github.sha }}"
62+
export COMMIT="${{ github.sha }}"
63+
export BUILD_DATE="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
64+
make release-docker-core
6165
6266
- name: Package core artifacts
6367
run: |
@@ -98,7 +102,11 @@ jobs:
98102
go-version-file: go.mod
99103

100104
- name: Build host macOS binary
101-
run: make build-host VERSION=${{ github.ref_type == 'tag' && github.ref_name || github.sha }}
105+
run: |
106+
export VERSION="${{ github.ref_type == 'tag' && github.ref_name || github.sha }}"
107+
export COMMIT="${{ github.sha }}"
108+
export BUILD_DATE="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
109+
make build-host
102110
103111
- name: Package macOS artifact
104112
run: |

Makefile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,18 +78,21 @@ build-darwin-arm64: prepare-output
7878

7979
release-local: build-linux-amd64 build-windows-amd64 build-darwin-amd64 build-darwin-arm64
8080

81+
# Pass version/commit/build-date into Docker so inner make uses them (CI sets VERSION=tag or sha).
82+
DOCKER_ENV_VARS := -e VERSION="$(VERSION)" -e COMMIT="$(COMMIT)" -e BUILD_DATE="$(BUILD_DATE)"
83+
8184
# Recommended: cross-build core artifacts with Docker to avoid host toolchain drift.
8285
# Note: current goreleaser-cross image does not provide Darwin compilers.
8386
release-docker:
84-
$(DOCKER) run --rm --entrypoint /bin/sh -v "$(PWD):/src" -w /src $(DOCKER_CROSS_IMAGE) -lc "export PATH=/usr/local/go/bin:$$PATH && apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends pkg-config libx11-dev libxkbcommon-dev libxkbcommon-x11-dev libx11-xcb-dev libxcursor-dev libxfixes-dev libwayland-dev libegl1-mesa-dev libgles2-mesa-dev libvulkan-dev && make release-inside-docker-core"
87+
$(DOCKER) run --rm $(DOCKER_ENV_VARS) --entrypoint /bin/sh -v "$(PWD):/src" -w /src $(DOCKER_CROSS_IMAGE) -lc "export PATH=/usr/local/go/bin:$$PATH && apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends pkg-config libx11-dev libxkbcommon-dev libxkbcommon-x11-dev libx11-xcb-dev libxcursor-dev libxfixes-dev libwayland-dev libegl1-mesa-dev libgles2-mesa-dev libvulkan-dev && make release-inside-docker-core"
8588
$(MAKE) release-docker-macos
8689

8790
release-docker-core:
88-
$(DOCKER) run --rm --entrypoint /bin/sh -v "$(PWD):/src" -w /src $(DOCKER_CROSS_IMAGE) -lc "export PATH=/usr/local/go/bin:$$PATH && apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends pkg-config libx11-dev libxkbcommon-dev libxkbcommon-x11-dev libx11-xcb-dev libxcursor-dev libxfixes-dev libwayland-dev libegl1-mesa-dev libgles2-mesa-dev libvulkan-dev && make release-inside-docker-core"
91+
$(DOCKER) run --rm $(DOCKER_ENV_VARS) --entrypoint /bin/sh -v "$(PWD):/src" -w /src $(DOCKER_CROSS_IMAGE) -lc "export PATH=/usr/local/go/bin:$$PATH && apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends pkg-config libx11-dev libxkbcommon-dev libxkbcommon-x11-dev libx11-xcb-dev libxcursor-dev libxfixes-dev libwayland-dev libegl1-mesa-dev libgles2-mesa-dev libvulkan-dev && make release-inside-docker-core"
8992

9093
# Optional macOS docker build; requires osxcross-compatible image/toolchain.
9194
release-docker-macos:
92-
$(DOCKER) run --rm --entrypoint /bin/sh -v "$(PWD):/src" -w /src $(DOCKER_CROSS_IMAGE) -lc "export PATH=/usr/local/osxcross/bin:/usr/local/go/bin:$$PATH && go mod download && find /root/go/pkg/mod -type f -path '*/gioui.org/x@*/explorer/*' -exec sed -i 's#<Appkit/AppKit.h>#<AppKit/AppKit.h>#' {} + && find /root/go/pkg/mod -type f \( -path '*/gioui.org/x@*/explorer/*.go' -o -path '*/gioui.org/x@*/notify/macos/*.go' \) -exec sed -i 's# -fmodules##g' {} + && find /root/go/pkg/mod -type f -path '*/gioui.org/x@*/explorer/explorer_macos.go' -exec sed -i '/#cgo CFLAGS:/a #cgo LDFLAGS: -framework UniformTypeIdentifiers' {} + && make release-inside-docker-macos"
95+
$(DOCKER) run --rm $(DOCKER_ENV_VARS) --entrypoint /bin/sh -v "$(PWD):/src" -w /src $(DOCKER_CROSS_IMAGE) -lc "export PATH=/usr/local/osxcross/bin:/usr/local/go/bin:$$PATH && go mod download && find /root/go/pkg/mod -type f -path '*/gioui.org/x@*/explorer/*' -exec sed -i 's#<Appkit/AppKit.h>#<AppKit/AppKit.h>#' {} + && find /root/go/pkg/mod -type f \( -path '*/gioui.org/x@*/explorer/*.go' -o -path '*/gioui.org/x@*/notify/macos/*.go' \) -exec sed -i 's# -fmodules##g' {} + && find /root/go/pkg/mod -type f -path '*/gioui.org/x@*/explorer/explorer_macos.go' -exec sed -i '/#cgo CFLAGS:/a #cgo LDFLAGS: -framework UniformTypeIdentifiers' {} + && make release-inside-docker-macos"
9396

9497
release-inside-docker-core: clean build-linux-amd64 build-windows-amd64
9598

0 commit comments

Comments
 (0)