-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial commit - docs: add example
- Loading branch information
0 parents
commit 3b786ed
Showing
6 changed files
with
106 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_size = 4 | ||
indent_style = space | ||
insert_final_newline = true | ||
max_line_length = 120 | ||
tab_width = 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: CI | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
schedule: | ||
- cron: "0 */3 * * *" | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup veHub | ||
uses: ./ | ||
|
||
- name: Check installation | ||
shell: bash | ||
run: | | ||
vehub --version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# setup-vehub | ||
|
||
This action sets up the veHub CLI, so that it can be used in subsequent steps. | ||
|
||
## Usage | ||
|
||
Example usage: | ||
|
||
```yaml | ||
steps: | ||
- name: Setup veHub CLI | ||
uses: vehub/setup-vehub@v1 | ||
|
||
- name: Check installation | ||
run: vehub --version | ||
|
||
- name: List project spaces | ||
run: vehub space list | ||
env: | ||
VEHUB_TOKEN: ${{ secrets.VEHUB_TOKEN }} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
name: 'Setup veHub' | ||
description: 'This action sets up the veHub CLI by downloading the latest version.' | ||
author: 'Vector Informatik GmbH' | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Greet and Record Time # name of step | ||
id: greet | ||
run: ${{ github.action_path }}/setup-vehub.sh | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
# Central installation directory | ||
INSTALL_DIR="/usr/local/bin" | ||
|
||
echo "Downloading veHub CLI..." | ||
DATA=$(curl -s 'https://search.vector.com/at-de/_search/' \ | ||
-H 'content-type: application/json' \ | ||
-H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) Chrome/115.0.5790.102' \ | ||
--data-raw '{"from":0,"size":45,"query":{"function_score":{"score_mode":"first","boost_mode":"multiply","query":{"bool":{"should":[],"filter":[{"match":{"type":{"query":"downloads","boost":1,"operator":"AND"}}}],"must":[{"terms":{"downloadType":["freeware","demos","drivers","service"]}},{"terms":{"categoryProductDefaultLang":["69969"]}}]}}}},"explain":false,"sort":[{"sortdate":"desc"}]}') | ||
|
||
LATEST_VERSION=$(echo $DATA | jq '[.hits.hits[] | select(._source.operatingSystem == "1")][0] | ._source | {title: .title, version: .version, url: .url}') | ||
echo $LATEST_VERSION | jq '{title: .title, version: .version}' | ||
|
||
URL=$(echo $LATEST_VERSION | jq -r '.url | fromjson | .downloadAction' | head -n 1) | ||
|
||
echo "Downloading from $URL..." | ||
|
||
curl -L "https://vector.com$URL" \ | ||
-H 'content-type: application/json' \ | ||
-H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) Chrome/115.0.5790.102' -o cli.zip | ||
|
||
echo "Extracting veHub CLI..." | ||
unzip cli.zip -d cli | ||
|
||
# Make the binary executable | ||
chmod +x cli/vehub | ||
|
||
# Move the binary to /usr/local/bin to make it globally accessible | ||
sudo mv cli/vehub "$INSTALL_DIR" | ||
|
||
# Verify installation | ||
if command -v vehub &> /dev/null | ||
then | ||
echo "veHub CLI installed successfully at $(command -v vehub)" | ||
else | ||
echo "veHub CLI installation failed!" | ||
exit 1 | ||
fi |