Skip to content
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

Download supported-formats during installation-script #156

Closed
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
9 changes: 9 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ jobs:
restore-keys: |
${{ matrix.os }}-go

- name: Download embeddings
run: |
./scripts/download.sh

- name: Build
run: |
go generate
Expand Down Expand Up @@ -87,8 +91,13 @@ jobs:
restore-keys: |
${{ matrix.os }}-go

- name: Download embeddings
run: |
./scripts/download.sh

- name: Build
run: |
./scripts/download.sh
go generate
go build -v ./...

Expand Down
9 changes: 9 additions & 0 deletions scripts/download.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

SCRIPT_DIR="$(dirname "$(realpath "$0")")"
PROJ_DIR="$(realpath "$SCRIPT_DIR/..")"
REMOTE_JSON_URL=https://debricked.com/api/1.0/open/files/supported-formats
LOCAL_JSON_DIR=$PROJ_DIR/internal/file/embedded
LOCAL_JSON_FILE=$PROJ_DIR/internal/file/embedded/supported_formats.json

echo "Supported-formats is downloaded from remote for offline backup"
mkdir -p $LOCAL_JSON_DIR && wget -O $LOCAL_JSON_FILE $REMOTE_JSON_URL
15 changes: 14 additions & 1 deletion scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@ if ! command -v git &> /dev/null
then
echo -e "Failed to find git, thus also the version. Version will be set to v0.0.0"
fi

SCRIPT_DIR="$(dirname "$(realpath "$0")")"
PROJ_DIR="$(realpath "$SCRIPT_DIR/..")"
REMOTE_JSON_URL=https://debricked.com/api/1.0/open/files/supported-formats
LOCAL_JSON_DIR=$PROJ_DIR/internal/file/embedded
LOCAL_JSON_FILE=$PROJ_DIR/internal/file/embedded/supported_formats.json


if [ ! -f "$LOCAL_JSON_FILE" ]; then
echo "Supported-formats is downloaded from remote for offline backup"
mkdir -p $LOCAL_JSON_DIR && wget -O $LOCAL_JSON_FILE $REMOTE_JSON_URL
fi

version=$(git symbolic-ref -q --short HEAD || git describe --tags --exact-match)
ldFlags="-X main.version=${version}"
go install -ldflags "${ldFlags}" ./cmd/debricked
go install -ldflags "${ldFlags}" $PROJ_DIR/cmd/debricked
Loading