Skip to content

Commit

Permalink
Update main.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
spiritLHLS authored Jan 13, 2024
1 parent 9986ee0 commit cbf12c5
Showing 1 changed file with 17 additions and 22 deletions.
39 changes: 17 additions & 22 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,43 +13,38 @@ jobs:
- name: check path
run: |
pwd
- name: build debian images
run: |
bash build_images.sh debian
- name: Configure Git
run: |
git config --global user.name "daily-update"
git config --global user.email "tg@spiritlhl.top"
- name: List and upload zip files
- name: Build and Upload Images
run: |
- name: List and upload zip files
run: |
for file in *.zip; do
# Assuming your GitHub repository is named "username/repo"
for distro in debian ubuntu kali centos almalinux rockylinux alpine openwrt oracle archlinux; do
bash build_images.sh $distro
release_id=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/oneclickvirt/incus_images/releases/tags/debian" \
"https://api.github.com/repos/oneclickvirt/incus_images/releases/tags/$distro" \
| jq -r '.id')
# Check if the asset with the same name already exists
existing_asset_id=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/oneclickvirt/incus_images/releases/$release_id/assets" \
| jq -r --arg name "$(basename "$file")" '.[] | select(.name == $name) | .id')
if [ -n "$existing_asset_id" ]; then
# Delete existing asset with the same name
curl -X DELETE -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/oneclickvirt/incus_images/releases/assets/$existing_asset_id"
fi
# Upload the new asset
echo "Uploading $file to release..."
curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "Content-Type: application/zip" \
--data-binary @"$file" \
"https://uploads.github.com/repos/oneclickvirt/incus_images/releases/$release_id/assets?name=$(basename "$file")"

for file in *.zip; do
echo "\nUploading $file to release..."
curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "Content-Type: application/zip" \
--data-binary @"$file" \
"https://uploads.github.com/repos/oneclickvirt/incus_images/releases/$release_id/assets?name=$(basename "$file")"
done
done

0 comments on commit cbf12c5

Please sign in to comment.