Skip to content

Commit 47fb7ca

Browse files
committed
testing workflow
1 parent 3d04d12 commit 47fb7ca

File tree

3 files changed

+31
-38
lines changed

3 files changed

+31
-38
lines changed

.github/workflows/testapp.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
- name: Upload l2 binary
2626
uses: actions/upload-artifact@v3
2727
with:
28-
name: l2-binary
28+
name: l2
2929
path: build/l2
3030
# - name: Deploy hexmos doc
3131
# run: curl -X POST --fail -F token=${{ secrets.TRIGGER_TOKEN }} -F ref=main https://git.apps.hexmos.com/api/v4/projects/85/trigger/pipeline

internal_release.sh

Lines changed: 25 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -5,59 +5,47 @@ GREEN='\033[0;32m'
55
NC='\033[0m' # No Color
66

77
REPO="HexmosTech/Lama2"
8-
ARTIFACT_NAME="l2-binary"
8+
ARTIFACT_NAME="l2"
99

10-
# Function to get the latest workflow run ID
11-
get_latest_workflow_run_id() {
10+
get_latest_run_id() {
1211
curl -s "https://api.github.com/repos/$REPO/actions/runs?status=success" |
1312
jq '.workflow_runs[0].id'
1413
}
1514

16-
# Function to get the artifact download URL
17-
get_artifact_url() {
18-
local run_id=$1
19-
curl -s "https://api.github.com/repos/$REPO/actions/runs/$run_id/artifacts" |
20-
jq -r ".artifacts[] | select(.name == \"$ARTIFACT_NAME\") | .archive_download_url"
21-
}
22-
23-
# Main installation process
24-
main() {
25-
echo "Fetching the latest successful workflow run..."
26-
run_id=$(get_latest_workflow_run_id)
27-
echo "Latest workflow run ID: $run_id"
28-
15+
download_artifact() {
16+
run_id=$(get_latest_run_id)
2917
if [ -z "$run_id" ]; then
30-
echo -e "${RED}Failed to fetch the latest workflow run.${NC}"
18+
echo -e "${RED}Failed to get the latest successful run ID${NC}"
3119
exit 1
3220
fi
3321

34-
echo "Getting artifact download URL..."
35-
artifact_url=$(get_artifact_url $run_id)
22+
artifact_url=$(curl -s "https://api.github.com/repos/$REPO/actions/runs/$run_id/artifacts" |
23+
jq -r ".artifacts[] | select(.name == \"$ARTIFACT_NAME\") | .archive_download_url")
3624

3725
if [ -z "$artifact_url" ]; then
38-
echo -e "${RED}Failed to get artifact download URL.${NC}"
26+
echo -e "${RED}Failed to find the artifact download URL${NC}"
3927
exit 1
4028
fi
4129

42-
echo "Downloading l2 binary..."
30+
echo "Downloading artifact from $artifact_url"
4331
curl -L -o /tmp/l2.zip "$artifact_url"
32+
33+
unzip /tmp/l2.zip -d /tmp
34+
rm /tmp/l2.zip
35+
}
4436

45-
echo "Extracting l2 binary..."
46-
unzip -o /tmp/l2.zip -d /tmp
47-
48-
echo "Installing l2 binary..."
49-
sudo mv /tmp/l2 /usr/local/bin/l2
37+
install_binary() {
38+
sudo rm -f /usr/local/bin/l2 /usr/bin/l2
39+
sudo mv /tmp/l2 /usr/local/bin
5040
sudo chmod +x /usr/local/bin/l2
51-
52-
if l2 > /dev/null 2>&1; then
53-
echo -e "${GREEN}Successfully installed Lama2; Type 'l2 <api_file>' to invoke Lama2${NC}"
54-
else
55-
echo -e "${RED}Failure in installation; please report issue at github.com/HexmosTech/Lama2${NC}"
56-
fi
57-
58-
# Clean up
59-
rm /tmp/l2.zip
6041
}
6142

62-
# Run the main function
63-
main
43+
# Main execution
44+
download_artifact
45+
install_binary
46+
47+
if l2 --version > /dev/null 2>&1; then
48+
echo -e "${GREEN}Successfully installed Lama2; Type 'l2 <api_file>' to invoke Lama2${NC}"
49+
else
50+
echo -e "${RED}Failure in installation; please report issue at github.com/HexmosTech/Lama2${NC}"
51+
fi

l2_temp/l2-binary.zip

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"message": "You must have the actions scope to download artifacts.",
3+
"documentation_url": "https://docs.github.com/rest/actions/artifacts#download-an-artifact",
4+
"status": "403"
5+
}

0 commit comments

Comments
 (0)