Skip to content

Commit

Permalink
ci(lhctl): fix release logic (#968)
Browse files Browse the repository at this point in the history
This fixes the builds after the golang refactor
  • Loading branch information
mijailr authored Aug 23, 2024
1 parent 29aa77d commit 42b1822
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ jobs:
- name: Build
uses: goreleaser/goreleaser-action@v6
with:
args: release --snapshot --clean
args: release --clean --skip=announce,publish,validate

- name: Upload release archive
uses: actions/upload-artifact@v4
Expand Down
7 changes: 5 additions & 2 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ checksum:

builds:
- id: build
main: ./lhctl
dir: ./lhctl
main: ./
env:
- CGO_ENABLED=0
goos:
Expand All @@ -27,7 +28,9 @@ builds:
goarch:
- amd64
- arm64

before:
hooks:
- ./local-dev/setup-go.sh
archives:
- format: tar.gz
# this name template makes the OS and Arch compatible with the results of `uname`.
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ repos:
language: system
always_run: true
pass_filenames: false
entry: go test ./sdk-go/...
entry: cd ./sdk-go && go test ./...

- id: python-tests
name: Running SDK Python Tests
Expand Down
17 changes: 11 additions & 6 deletions docker/lhctl/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
FROM ubuntu:22.04
COPY . /lh
RUN apt update && apt install -y --no-install-recommends \
jq git ca-certificates wget curl tar unzip golang && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
FROM golang:1.22-alpine

WORKDIR /lh
COPY . .
WORKDIR /lh/lhctl

# remove go.work file to avoid error
RUN rm -f go.work

RUN go work init && go work use ../sdk-go && go work use .
RUN GOBIN=/usr/local/bin go install .
WORKDIR /
RUN rm -rf /lh

ENTRYPOINT ["/usr/local/bin/lhctl"]
18 changes: 18 additions & 0 deletions local-dev/setup-go.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

# get current path
SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
CONTEXT_DIR=$(cd "$SCRIPT_DIR/.." && pwd)

set -e

cd $CONTEXT_DIR/lhctl

# if go.work file exists, remove it
if [ -f go.work ]; then
rm go.work
fi
go work init

go work use ../sdk-go
go work use .

0 comments on commit 42b1822

Please sign in to comment.