Skip to content

chore: include gptscript-credential-helpers in packaging #275

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
**/__pycache__
/docs/yarn.lock
/releases
/binaries
/checksums.txt
/.env*
6 changes: 6 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ before:
hooks:
# Generate UI assets to embedded in binaries
- make build-ui
- ./scripts/download-cred-helpers.sh

builds:
- id: default
Expand All @@ -21,12 +22,16 @@ builds:
- -s
- -w
- -X "github.com/gptscript-ai/gptscript/pkg/version.Tag=v{{ .Version }}"
hooks:
post: ./scripts/copy-cred-helper.sh {{ .Os }} {{ .Arch }}

universal_binaries:
- id: mac
ids:
- default
replace: true
hooks:
post: cp binaries/gptscript-credential-osxkeychain releases/mac_darwin_all

archives:
- id: default
Expand Down Expand Up @@ -60,6 +65,7 @@ brews:
- description: "GPTScript CLI"
install: |
bin.install "gptscript"
{{ if eq .Os "darwin" }}bin.install "gptscript-credential-osxkeychain"{{ end }}
homepage: "https://github.com/gptscript-ai/gptscript"
skip_upload: false
folder: "Formula"
Expand Down
29 changes: 29 additions & 0 deletions scripts/copy-cred-helper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash

set -euo pipefail

OS="$1"
ARCH="$2"

case "$OS" in
"darwin")
case "$ARCH" in
"amd64")
cp binaries/gptscript-credential-osxkeychain releases/default_darwin_amd64_v1
;;
"arm64")
cp binaries/gptscript-credential-osxkeychain releases/default_darwin_arm64
;;
esac
;;
"windows")
case "$ARCH" in
"amd64")
cp binaries/gptscript-credential-wincred-amd64.exe releases/default_windows_amd64_v1/gptscript-credential-wincred.exe
;;
"arm64")
cp binaries/gptscript-credential-wincred-arm64.exe releases/default_windows_arm64/gptscript-credential-wincred.exe
;;
esac
;;
esac
20 changes: 20 additions & 0 deletions scripts/download-cred-helpers.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash

set -euo pipefail

# This script downloads the gptscript-credential-helpers. (For use in CI.)

GPTSCRIPT_CRED_HELPERS_VERSION="v0.1.0"
BINARY_DIR="binaries"

mkdir -p "$BINARY_DIR"
cd "$BINARY_DIR"

wget -O gptscript-credential-osxkeychain "https://github.com/gptscript-ai/gptscript-credential-helpers/releases/download/${GPTSCRIPT_CRED_HELPERS_VERSION}/gptscript-credential-osxkeychain"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why wget :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually like wget a lot just for downloading files, lol. I can never remember the arguments I need to give to curl. 🤷‍♂️

chmod +x gptscript-credential-osxkeychain

wget -O gptscript-credential-wincred-amd64.exe "https://github.com/gptscript-ai/gptscript-credential-helpers/releases/download/${GPTSCRIPT_CRED_HELPERS_VERSION}/gptscript-credential-wincred-${GPTSCRIPT_CRED_HELPERS_VERSION}.windows-amd64.exe"
chmod +x gptscript-credential-wincred-amd64.exe

wget -O gptscript-credential-wincred-arm64.exe "https://github.com/gptscript-ai/gptscript-credential-helpers/releases/download/${GPTSCRIPT_CRED_HELPERS_VERSION}/gptscript-credential-wincred-${GPTSCRIPT_CRED_HELPERS_VERSION}.windows-arm64.exe"
chmod +x gptscript-credential-wincred-arm64.exe