release v1.0.2

This commit is contained in:
2024-12-03 18:00:10 +06:00
parent 8758ab19ef
commit fa0a8565c3
7 changed files with 22 additions and 25 deletions

View File

@@ -11,7 +11,7 @@ COPY . .
RUN echo $BUILDPLATFORM > buildplatform RUN echo $BUILDPLATFORM > buildplatform
RUN echo $TARGETARCH > targetarch RUN echo $TARGETARCH > targetarch
# RUN GOOS=linux GOARCH=$TARGETARCH go build -o output/go-ansible-vault # RUN GOOS=linux GOARCH=$TARGETARCH go build -o /app/go-lcg .
RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} garble -literals -tiny build -ldflags="-w -s" -o /app/go-lcg . RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} garble -literals -tiny build -ldflags="-w -s" -o /app/go-lcg .
FROM alpine:latest FROM alpine:latest

View File

@@ -8,7 +8,7 @@ COPY go.* .
RUN go mod download RUN go mod download
COPY . . COPY . .
# RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o /out/go-ansible-vault . # RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o /out/go-lcg .
RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} garble -literals -tiny build -ldflags="-w -s" -o /out/go-lcg . RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} garble -literals -tiny build -ldflags="-w -s" -o /out/go-lcg .
FROM scratch AS bin-unix FROM scratch AS bin-unix

View File

@@ -1 +1 @@
v1.0.1 v1.0.2

10
main.go
View File

@@ -44,12 +44,20 @@ Usage: lcg [options]
--help -h output usage information --help -h output usage information
--version -v output the version number --version -v output the version number
--file -f read command from file --file -f read part of command from file or bash feature $(...)
--update-key -u update the API key --update-key -u update the API key
--delete-key -d delete the API key --delete-key -d delete the API key
Example Usage: lcg I want to extract linux-command-gpt.tar.gz file Example Usage: lcg I want to extract linux-command-gpt.tar.gz file
Example Usage: lcg --file /path/to/file.json I want to print object questions with jq Example Usage: lcg --file /path/to/file.json I want to print object questions with jq
Env Vars:
LCG_HOST - defaults to "http://192.168.87.108:11434/" - endpoint for Ollama or other LLM API
LCG_COMPLETIONS_PATH -defaults to "api/chat" - relative part of endpoint
LCG_MODEL - defaults to "codegeex4"
LCG_PROMPT - defaults to Reply with linux command and nothing else. Output with plain response - no need formatting. No need explanation. No need code blocks.
LCG_API_KEY_FILE - defaults to ${HOME}/.openai_api_key - file with API key
LCG_RESULT_FOLDER - defaults to $(pwd)/gpt_results - folder to save results
` `
VERSION = Version VERSION = Version

View File

@@ -4,5 +4,5 @@ docker build -f Dockerfiles/LocalCompile/Dockerfile --target bin-linux --output
docker build -f Dockerfiles/LocalCompile/Dockerfile --target bin-linux --output bin-linux-arm64/ --platform linux/arm64 . docker build -f Dockerfiles/LocalCompile/Dockerfile --target bin-linux --output bin-linux-arm64/ --platform linux/arm64 .
# in linux setuid # in linux setuid
# sudo chown root:root bin-linux/go-ansible-vault # sudo chown root:root bin-linux/lcg
# sudo chmod +s bin-linux/go-ansible-vault # sudo chmod +s bin-linux/lcg

View File

@@ -1,13 +1,13 @@
#!/bin/bash #!/bin/bash
REPO=kuznetcovay/go-ansible-vault REPO=kuznetcovay/go-lcg
VERSION=$1 VERSION=$1
if [ -z "$VERSION" ]; then if [ -z "$VERSION" ]; then
VERSION=v1.0.8 VERSION=v1.0.8
fi fi
BRANCH=main BRANCH=main
echo ${VERSION} > VERSION.txt echo "${VERSION}" > VERSION.txt
export GOCACHE="${HOME}/.cache/go-build" export GOCACHE="${HOME}/.cache/go-build"
# Save the current branch # Save the current branch
@@ -34,7 +34,7 @@ if ! go test -v -run=^Test; then
fi fi
# Push multi-platform images # Push multi-platform images
docker buildx build --push --platform linux/amd64,linux/arm64 -t ${REPO}:${VERSION} . || docker buildx build --push --platform linux/amd64,linux/arm64 -t ${REPO}:"${VERSION}" . ||
{ {
echo "docker buildx build --push failed. Exiting with code 1." echo "docker buildx build --push failed. Exiting with code 1."
exit 1 exit 1

View File

@@ -5,28 +5,18 @@ VERSION_FILE="VERSION.txt"
GITHUB_TOKEN="${GITHUB_TOKEN}" # Replace with your GitHub token GITHUB_TOKEN="${GITHUB_TOKEN}" # Replace with your GitHub token
REPO="Direct-Dev-Ru/binaries.git" # Replace with your GitHub username/repo REPO="direct-dev-ru/binaries" # Replace with your GitHub username/repo
TAG=go-ansible-vault.$(cat "$VERSION_FILE") TAG=lcg.$(cat "$VERSION_FILE")
echo $TAG echo TAG: $TAG
RELEASE_NAME="Binaries ${TAG}" # Replace with your release title RELEASE_DIR="/home/su/projects/golang/linux-command-gpt/binaries-for-upload"
RELEASE_DIR="/home/su/projects/golang/ansible-vault/binaries-for-upload"
# Create a new release
# response=$(curl -s -X POST \
# -H "Authorization: Bearer ${GITHUB_TOKEN}" \
# -H "Accept: application/vnd.github+json" \
# -H "X-GitHub-Api-Version: 2022-11-28" \
# https://api.github.com/repos/$REPO/releases \
# -d "{\"tag_name\": \"$TAG\", \"name\": \"$RELEASE_NAME\"}")
body="{\"tag_name\":\"${TAG}\", \"target_commitish\":\"main\", \"name\":\"${TAG}\", \ body="{\"tag_name\":\"${TAG}\", \"target_commitish\":\"main\", \"name\":\"${TAG}\", \
\"body\":\"${TAG}\", \"draft\":false, \"prerelease\":false, \"generate_release_notes\":false}" \"body\":\"${TAG}\", \"draft\":false, \"prerelease\":false, \"generate_release_notes\":false}"
echo $body echo BODY: $body
response=$(curl -L -X POST \ response=$(curl -L -X POST \
-H "Accept: application/vnd.github+json" \ -H "Accept: application/vnd.github+json" \
@@ -35,7 +25,6 @@ response=$(curl -L -X POST \
https://api.github.com/repos/direct-dev-ru/binaries/releases \ https://api.github.com/repos/direct-dev-ru/binaries/releases \
-d $body) -d $body)
echo $response echo $response
# Extract the upload URL from the response # Extract the upload URL from the response