Skip to content

Commit f69c877

Browse files
committed
Fix download artifact from GitHub
1 parent 2e1f3fa commit f69c877

File tree

2 files changed

+38
-7
lines changed

2 files changed

+38
-7
lines changed

.github/actions/opendaq-github-download-artifact/action.yml

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,37 @@ runs:
2020
run: |
2121
DEST="${{ inputs.destination-dir }}"
2222
DEST=$(echo "$DEST" | sed 's|\\|/|g')
23+
RUN_ID="${{ inputs.opendaq-artifact-run-id }}"
2324
2425
ARTIFACT_NAME="${{ inputs.opendaq-artifact-name }}"
2526
ARTIFACT_DIR="$DEST/$ARTIFACT_NAME"
2627
27-
gh run download "${{ inputs.opendaq-artifact-run-id }}" \
28-
--repo openDAQ/openDAQ \
29-
--pattern "$ARTIFACT_NAME" \
30-
--dir "$DEST"
28+
echo "ARTIFACT_DIR=$ARTIFACT_DIR"
29+
echo "ARTIFACT_NAME=$ARTIFACT_NAME"
30+
echo "RUN_ID=$RUN_ID"
31+
32+
REPO="openDAQ/openDAQ"
33+
34+
35+
URL=$(gh api repos/$REPO/actions/runs/$RUN_ID/artifacts \
36+
--jq ".artifacts[] | select(.name==\"$ARTIFACT_NAME\") | .archive_download_url")
37+
38+
echo "URL to download: '$url'"
39+
if [ -z "$URL" ]; then
40+
echo "❌ Artifact '$ARTIFACT_NAME' not found in run $RUN_ID"
41+
exit 1
42+
fi
43+
44+
ZIP_PATH="$DEST/$ARTIFACT_NAME.zip"
45+
gh api "$URL" --output "$ZIP_PATH"
46+
47+
echo "📦 Downloaded $ZIP_PATH"
48+
unzip -o "$ZIP_PATH" -d "$DEST/$ARTIFACT_NAME"
49+
50+
# gh run download ${{ inputs.opendaq-artifact-run-id }} \
51+
# --repo openDAQ/openDAQ \
52+
# --name $ARTIFACT_NAME \
53+
# --dir "$DEST"
3154
3255
echo "$ARTIFACT_DIR/"
3356
ls -la "$ARTIFACT_DIR/"

.github/workflows/build-tests.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,19 @@ jobs:
6363
repository: openDAQ/SimpleDeviceModule
6464
ref: ${{ inputs.branch }}
6565

66+
# - name: Download openDAQ framework package
67+
# uses: ./.github/actions/opendaq-github-download-artifact
68+
# with:
69+
# opendaq-artifact-run-id: ${{ inputs.artifact-run-id }}
70+
# opendaq-artifact-name: ${{ inputs.artifact-name }}
71+
6672
- name: Download openDAQ framework package
67-
uses: ./.github/actions/opendaq-github-download-artifact
73+
id: download
74+
uses: openDAQ/actions/framework-download-artifact@action-opendaq-version-parse
6875
with:
69-
opendaq-artifact-run-id: ${{ inputs.artifact-run-id }}
70-
opendaq-artifact-name: ${{ inputs.artifact-name }}
76+
run-id: ${{ inputs.artifact-run-id }}
77+
artifact-name: ${{ inputs.artifact-name }}
78+
artifact-filename: ${{ inputs.file-name }}
7179

7280
- name: Install openDAQ framework package
7381
uses: ./.github/actions/framework-install

0 commit comments

Comments
 (0)