Skip to content

Commit b830205

Browse files
committed
feat: adding valthrun portal upload
1 parent 42671fd commit b830205

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
artifact="$1"
2+
artifact_track="$2"
3+
file_path="$3"
4+
5+
file_name=$(basename -- "$file_path")
6+
7+
git_commit_shash=$(git rev-parse --short "$GITHUB_SHA")
8+
git_branch=$(echo $GITHUB_REF | cut -d'/' -f 3)
9+
10+
version="$ARTIFACT_VERSION"
11+
if [[ -z "$ARTIFACT_VERSION" ]]; then
12+
echo "Missing ARTIFACT_VERSION env var"
13+
exit 1
14+
fi
15+
16+
echo "Uploading $file_path"
17+
curl -H "Content-Type:multipart/form-data" \
18+
-X POST \
19+
-F "info={\"version\": \"$version\", \"versionHash\": \"$git_commit_shash\", \"updateLatest\": true }" \
20+
-F "payload=@$file_path; filename=${artifact}_${git_commit_shash}.${file_name##*.}" \
21+
"https://valth.run/api/artifacts/$artifact/$artifact_track?api-key=$ARTIFACT_API_KEY" || exit 1

.github/workflows/rust.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,19 @@ jobs:
5050
cache-on-failure: true
5151

5252
- name: Build
53-
run: cargo build --verbose --release --bin loader
53+
run: cargo build --verbose --release --bin valthrun-loader
5454
env:
5555
RUSTFLAGS: -Ctarget-feature=+crt-static
5656

5757
- name: Upload executable artifact
5858
uses: actions/upload-artifact@v4
5959
with:
6060
name: loader.exe
61-
path: target/release/loader.exe
61+
path: target/release/valthrun-loader.exe
62+
63+
- name: Upload release build to portal
64+
shell: bash
65+
run: .github/workflows/artifact_upload.sh valthrun-loader target/release/valthrun-loader.exe
66+
if: ${{ github.event_name != 'pull_request' }}
67+
env:
68+
ARTIFACT_API_KEY: ${{ secrets.ARTIFACT_API_KEY }}

0 commit comments

Comments
 (0)