Skip to content

Commit cbf12c5

Browse files
authored
Update main.yml
1 parent 9986ee0 commit cbf12c5

File tree

1 file changed

+17
-22
lines changed

1 file changed

+17
-22
lines changed

.github/workflows/main.yml

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,43 +13,38 @@ jobs:
1313
- name: check path
1414
run: |
1515
pwd
16-
17-
- name: build debian images
18-
run: |
19-
bash build_images.sh debian
20-
16+
2117
- name: Configure Git
2218
run: |
2319
git config --global user.name "daily-update"
2420
git config --global user.email "tg@spiritlhl.top"
2521
26-
- name: List and upload zip files
22+
- name: Build and Upload Images
2723
run: |
28-
- name: List and upload zip files
29-
run: |
30-
for file in *.zip; do
31-
# Assuming your GitHub repository is named "username/repo"
24+
for distro in debian ubuntu kali centos almalinux rockylinux alpine openwrt oracle archlinux; do
25+
bash build_images.sh $distro
26+
3227
release_id=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
3328
-H "Accept: application/vnd.github.v3+json" \
34-
"https://api.github.com/repos/oneclickvirt/incus_images/releases/tags/debian" \
29+
"https://api.github.com/repos/oneclickvirt/incus_images/releases/tags/$distro" \
3530
| jq -r '.id')
36-
37-
# Check if the asset with the same name already exists
31+
3832
existing_asset_id=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
3933
-H "Accept: application/vnd.github.v3+json" \
4034
"https://api.github.com/repos/oneclickvirt/incus_images/releases/$release_id/assets" \
4135
| jq -r --arg name "$(basename "$file")" '.[] | select(.name == $name) | .id')
42-
36+
4337
if [ -n "$existing_asset_id" ]; then
44-
# Delete existing asset with the same name
4538
curl -X DELETE -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
4639
"https://api.github.com/repos/oneclickvirt/incus_images/releases/assets/$existing_asset_id"
4740
fi
48-
49-
# Upload the new asset
50-
echo "Uploading $file to release..."
51-
curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
52-
-H "Content-Type: application/zip" \
53-
--data-binary @"$file" \
54-
"https://uploads.github.com/repos/oneclickvirt/incus_images/releases/$release_id/assets?name=$(basename "$file")"
41+
42+
for file in *.zip; do
43+
echo "\nUploading $file to release..."
44+
curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
45+
-H "Content-Type: application/zip" \
46+
--data-binary @"$file" \
47+
"https://uploads.github.com/repos/oneclickvirt/incus_images/releases/$release_id/assets?name=$(basename "$file")"
48+
done
5549
done
50+

0 commit comments

Comments
 (0)