Skip to content

Commit 2f89979

Browse files
committed
Update Docker workflow
1 parent 73e1d41 commit 2f89979

File tree

1 file changed

+31
-11
lines changed

1 file changed

+31
-11
lines changed

.github/workflows/build-armbian-arm64-docker-image.yml

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,39 @@ jobs:
4747
id: down
4848
if: (!cancelled())
4949
run: |
50-
# Get Armbian file
51-
armbian_url="$(curl \
52-
--header "authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
53-
-s "https://api.github.com/repos/${{ github.repository }}/releases?per_page=20" |
54-
grep -o "Armbian_${{ inputs.source_branch }}_arm64_.*/.*rootfs.tar.gz" |
55-
sort -urV |
56-
head -n 1
57-
)"
58-
[[ -z "${armbian_url}" ]] && echo -e "Armbian file not found!" && exit 1
50+
# Get Armbian rootfs file
51+
latest_version=$(curl -s \
52+
-H "Accept: application/vnd.github+json" \
53+
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
54+
https://api.github.com/repos/${{ github.repository }}/releases?per_page=20 | \
55+
jq -r --arg RTK "Armbian_${{ inputs.source_branch }}_arm64_" \
56+
--arg BOARD "rootfs" \
57+
'[.[] | select(.tag_name | contains($RTK))] |
58+
map(.assets[] | select(.name | contains($BOARD) and endswith(".tar.gz"))) |
59+
sort_by(.updated_at) |
60+
reverse |
61+
.[0] |
62+
{data: .updated_at, url: .url, name: .name}')
5963
64+
[[ -z "${latest_version}" || "${latest_version}" == "null" ]] && {
65+
echo "Invalid Armbian rootfs file download address."
66+
exit 1
67+
}
68+
69+
# Get URL and filename separately
70+
latest_url="$(echo ${latest_version} | jq -r '.url')"
71+
armbian_filename="$(echo ${latest_version} | jq -r '.name')"
72+
73+
# Download using API method (add octet-stream header)
74+
echo "Downloading: ${armbian_filename}"
6075
[[ -d "armbian" ]] || mkdir -p armbian
61-
curl -fsSL "https://github.com/${{ github.repository }}/releases/download/${armbian_url}" -o "armbian/$(basename ${armbian_url})"
62-
[[ "${?}" -ne "0" ]] && echo "Armbian file download failed." && exit 1
76+
curl -fsSL \
77+
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
78+
-H "Accept: application/octet-stream" \
79+
"${latest_url}" \
80+
-o "armbian/${armbian_filename}"
81+
[[ "${?}" -ne "0" ]] && echo "Download failed." && exit 1
82+
6383
echo "status=success" >> ${GITHUB_OUTPUT}
6484
6585
- name: Build the Docker image

0 commit comments

Comments
 (0)