Jaimodiji commited on
Commit
38c7ae5
Β·
verified Β·
1 Parent(s): dcb9988

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. .build_counter +1 -1
  2. 1.deploy.sh +13 -18
.build_counter CHANGED
@@ -1 +1 @@
1
- 12
 
1
+ 13
1.deploy.sh CHANGED
@@ -1,7 +1,7 @@
1
  #!/usr/bin/env bash
2
 
3
  # --- CONFIGURATION ---
4
- WORKFLOW_ID="221629785" # ID for 'Build Android (Bundled HuggingFace)'
5
  ARTIFACT_NAME="tldraw-bundled-hf-debug.apk"
6
  TARGET_DIR="/storage/emulated/0/Download/MY-T-APP"
7
  COUNTER_FILE=".build_counter"
@@ -22,9 +22,7 @@ echo "πŸš€ Starting Hugging Face Upload..."
22
  --exclude "*.log"
23
 
24
  # 2. GIT INCREMENTAL COMMIT
25
- # Check/Create counter file
26
  if [ ! -f "$COUNTER_FILE" ]; then echo 0 > "$COUNTER_FILE"; fi
27
- # Read, Increment, Save
28
  CURRENT_COUNT=$(cat "$COUNTER_FILE")
29
  NEXT_COUNT=$((CURRENT_COUNT + 1))
30
  echo "$NEXT_COUNT" > "$COUNTER_FILE"
@@ -37,18 +35,13 @@ git commit -m "$COMMIT_MSG"
37
  git push
38
 
39
  # 3. TRIGGER GITHUB ACTION
40
- echo "🎬 Triggering GitHub Action (ID: $WORKFLOW_ID)..."
41
  gh workflow run "$WORKFLOW_ID"
42
-
43
- # Give GitHub a moment to register the run
44
  echo "⏳ Waiting for run to start..."
45
  sleep 5
46
-
47
- # Get the ID of the run we just triggered (the most recent one)
48
  RUN_ID=$(gh run list --workflow "$WORKFLOW_ID" --limit 1 --json databaseId -q '.[0].databaseId')
49
  echo "πŸ‘€ Watching Run ID: $RUN_ID"
50
 
51
- # Watch the run until it finishes. If it fails, exit script.
52
  gh run watch "$RUN_ID" --exit-status
53
  if [ $? -ne 0 ]; then
54
  echo "❌ Build Failed on GitHub! Check logs."
@@ -57,20 +50,22 @@ fi
57
 
58
  # 4. DOWNLOAD AND MOVE ARTIFACT
59
  echo "πŸ“₯ Downloading artifact..."
60
- # Create target directory if it doesn't exist
61
  mkdir -p "$TARGET_DIR"
62
-
63
- # Download to a temporary folder
64
  mkdir -p temp_artifact
 
 
65
  gh run download "$RUN_ID" -n "$ARTIFACT_NAME" --dir temp_artifact
66
 
67
- # Unzip and Move
68
- # GitHub wraps artifacts in a zip. We unzip it and move the .apk file.
69
- echo "πŸ“‚ Extracting and moving to Android storage..."
70
- unzip -o temp_artifact/*.zip -d temp_artifact/
71
- find temp_artifact -name "*.apk" -exec mv {} "$TARGET_DIR/" \;
72
 
73
  # Cleanup
74
  rm -rf temp_artifact
75
 
76
- echo "βœ… DONE! APK saved to: $TARGET_DIR"
 
 
 
 
 
 
1
  #!/usr/bin/env bash
2
 
3
  # --- CONFIGURATION ---
4
+ WORKFLOW_ID="221629785" # Build Android (Bundled HuggingFace)
5
  ARTIFACT_NAME="tldraw-bundled-hf-debug.apk"
6
  TARGET_DIR="/storage/emulated/0/Download/MY-T-APP"
7
  COUNTER_FILE=".build_counter"
 
22
  --exclude "*.log"
23
 
24
  # 2. GIT INCREMENTAL COMMIT
 
25
  if [ ! -f "$COUNTER_FILE" ]; then echo 0 > "$COUNTER_FILE"; fi
 
26
  CURRENT_COUNT=$(cat "$COUNTER_FILE")
27
  NEXT_COUNT=$((CURRENT_COUNT + 1))
28
  echo "$NEXT_COUNT" > "$COUNTER_FILE"
 
35
  git push
36
 
37
  # 3. TRIGGER GITHUB ACTION
38
+ echo "🎬 Triggering GitHub Action..."
39
  gh workflow run "$WORKFLOW_ID"
 
 
40
  echo "⏳ Waiting for run to start..."
41
  sleep 5
 
 
42
  RUN_ID=$(gh run list --workflow "$WORKFLOW_ID" --limit 1 --json databaseId -q '.[0].databaseId')
43
  echo "πŸ‘€ Watching Run ID: $RUN_ID"
44
 
 
45
  gh run watch "$RUN_ID" --exit-status
46
  if [ $? -ne 0 ]; then
47
  echo "❌ Build Failed on GitHub! Check logs."
 
50
 
51
  # 4. DOWNLOAD AND MOVE ARTIFACT
52
  echo "πŸ“₯ Downloading artifact..."
 
53
  mkdir -p "$TARGET_DIR"
 
 
54
  mkdir -p temp_artifact
55
+
56
+ # gh run download AUTOMATICALLY unzips the file into the directory
57
  gh run download "$RUN_ID" -n "$ARTIFACT_NAME" --dir temp_artifact
58
 
59
+ echo "πŸ“‚ Moving APK to Android storage..."
60
+ # Find the apk (wherever it is inside the artifact) and move it
61
+ FOUND_COUNT=$(find temp_artifact -name "*.apk" -exec mv {} "$TARGET_DIR/" \; -print | wc -l)
 
 
62
 
63
  # Cleanup
64
  rm -rf temp_artifact
65
 
66
+ if [ "$FOUND_COUNT" -eq "0" ]; then
67
+ echo "❌ ERROR: No APK file was found in the downloaded artifact."
68
+ exit 1
69
+ else
70
+ echo "βœ… SUCCESS! $FOUND_COUNT APK(s) moved to: $TARGET_DIR"
71
+ fi