Skip to content

Commit

Permalink
Create version file in different ways
Browse files Browse the repository at this point in the history
  • Loading branch information
lil5 committed Dec 19, 2024
1 parent 84948fc commit 912a63d
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 8 deletions.
2 changes: 0 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,3 @@ environments/
*.swp
*.swo
.DS_Store

config/VERSION.txt
4 changes: 3 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
run: test -z "$(gofmt -l .)"
# Build the Go application
- name: Build the application
run: go generate ./... && go build -o tigerbeetle_api .
run: make build
build-and-publish:
runs-on: ubuntu-latest
needs: lint
Expand Down Expand Up @@ -65,6 +65,8 @@ jobs:
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Add version file
run: printf %s "${{ github.sha }}" > config/VERSION.txt
# Build and push the Docker image
- name: Build and push Docker image
uses: docker/build-push-action@v5
Expand Down
3 changes: 0 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ COPY . .
# Enable CGO and specify the Zig compiler
ENV CGO_ENABLED=1 CC="zig cc"
# Build the Go application
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
go generate ./...
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
go build -o tigerbeetle_api .
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ start:

.PHONY: build
build:
go generate ./...
printf %s $$(git rev-parse HEAD) > config/VERSION.txt
go build .

buildexec:
Expand Down
1 change: 0 additions & 1 deletion config/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@ package config

import _ "embed"

//go:generate sh -c "printf %s $(git rev-parse HEAD) > VERSION.txt"
//go:embed VERSION.txt
var version string

0 comments on commit 912a63d

Please sign in to comment.