|
|
@@ -41,78 +41,90 @@ jobs:
|
|
|
echo "Using latest release tag: $LATEST_TAG"
|
|
|
fi
|
|
|
|
|
|
- - name: Download artifacts from specified run
|
|
|
+ - name: Download AnyKernel3 artifacts from specified run
|
|
|
run: |
|
|
|
- echo "Downloading artifacts from run ID: ${{ inputs.run_id }}"
|
|
|
+ echo "Downloading AnyKernel3 artifacts from run ID: ${{ inputs.run_id }}"
|
|
|
|
|
|
# Create directory for downloaded artifacts
|
|
|
mkdir -p ./downloaded-artifacts
|
|
|
|
|
|
- # Download all artifacts from the specified run
|
|
|
- gh run download ${{ inputs.run_id }} --dir ./downloaded-artifacts --repo ${{ github.repository }}
|
|
|
+ # Get list of all artifacts from the run
|
|
|
+ echo "Getting artifact list from run..."
|
|
|
+ gh api repos/${{ github.repository }}/actions/runs/${{ inputs.run_id }}/artifacts --jq '.artifacts[] | select(.name | endswith("-AnyKernel3")) | {name: .name, id: .id}' > artifacts.json
|
|
|
|
|
|
- echo "Downloaded artifacts:"
|
|
|
- ls -la ./downloaded-artifacts/
|
|
|
-
|
|
|
- - name: Filter and prepare AnyKernel3 artifacts
|
|
|
- run: |
|
|
|
- echo "Filtering for AnyKernel3 artifacts..."
|
|
|
-
|
|
|
- # Count AnyKernel3 artifacts
|
|
|
- anykernel_count=0
|
|
|
- for dir in ./downloaded-artifacts/*/; do
|
|
|
- if [[ "$(basename "$dir")" == *"-AnyKernel3" ]]; then
|
|
|
- anykernel_count=$((anykernel_count + 1))
|
|
|
- echo "Found AnyKernel3 artifact: $(basename "$dir")"
|
|
|
- fi
|
|
|
- done
|
|
|
-
|
|
|
- if [ $anykernel_count -eq 0 ]; then
|
|
|
+ # Check if any AnyKernel3 artifacts were found
|
|
|
+ if [ ! -s artifacts.json ]; then
|
|
|
echo "Error: No AnyKernel3 artifacts found in run ${{ inputs.run_id }}"
|
|
|
- echo "Available artifacts:"
|
|
|
- ls -la ./downloaded-artifacts/
|
|
|
+ echo "Available artifacts in this run:"
|
|
|
+ gh api repos/${{ github.repository }}/actions/runs/${{ inputs.run_id }}/artifacts --jq '.artifacts[].name'
|
|
|
exit 1
|
|
|
fi
|
|
|
|
|
|
- echo "Found $anykernel_count AnyKernel3 artifacts to upload"
|
|
|
+ echo "Found AnyKernel3 artifacts:"
|
|
|
+ cat artifacts.json
|
|
|
+
|
|
|
+ # Download only the AnyKernel3 artifacts
|
|
|
+ while IFS= read -r artifact; do
|
|
|
+ artifact_name=$(echo "$artifact" | jq -r '.name')
|
|
|
+ artifact_id=$(echo "$artifact" | jq -r '.id')
|
|
|
+ echo "Downloading artifact: $artifact_name (ID: $artifact_id)"
|
|
|
+ gh api repos/${{ github.repository }}/actions/artifacts/$artifact_id/zip > "${artifact_name}.zip"
|
|
|
+
|
|
|
+ # Extract the artifact
|
|
|
+ unzip -q "${artifact_name}.zip" -d "./downloaded-artifacts/${artifact_name}/"
|
|
|
+ rm "${artifact_name}.zip"
|
|
|
+ done < <(jq -c '.' artifacts.json)
|
|
|
+
|
|
|
+ echo "Downloaded AnyKernel3 artifacts:"
|
|
|
+ ls -la ./downloaded-artifacts/
|
|
|
|
|
|
- - name: Upload artifacts to release
|
|
|
+ - name: Prepare and upload AnyKernel3 artifacts to release
|
|
|
run: |
|
|
|
- echo "Uploading artifacts to release: ${{ env.RELEASE_TAG }}"
|
|
|
+ echo "Preparing AnyKernel3 artifacts for upload..."
|
|
|
|
|
|
- # Check if release exists
|
|
|
- if ! gh release view ${{ env.RELEASE_TAG }} >/dev/null 2>&1; then
|
|
|
- echo "Error: Release ${{ env.RELEASE_TAG }} does not exist"
|
|
|
+ # Check if we have any downloaded artifacts
|
|
|
+ if [ ! -d "./downloaded-artifacts" ] || [ -z "$(ls -A ./downloaded-artifacts)" ]; then
|
|
|
+ echo "Error: No artifacts were downloaded"
|
|
|
exit 1
|
|
|
fi
|
|
|
|
|
|
- uploaded_count=0
|
|
|
- for dir in ./downloaded-artifacts/*/; do
|
|
|
- # Check if this is an AnyKernel3 artifact directory
|
|
|
- if [[ "$(basename "$dir")" == *"-AnyKernel3" ]]; then
|
|
|
- artifact_name=$(basename "$dir")
|
|
|
+ # Process each AnyKernel3 artifact directory
|
|
|
+ for artifact_dir in ./downloaded-artifacts/*/; do
|
|
|
+ if [ -d "$artifact_dir" ]; then
|
|
|
+ # Get the artifact name (remove path and trailing slash)
|
|
|
+ artifact_name=$(basename "$artifact_dir")
|
|
|
+
|
|
|
echo "Processing artifact: $artifact_name"
|
|
|
|
|
|
- # Create ZIP file from the artifact directory
|
|
|
- zip_name="${artifact_name}.zip"
|
|
|
- echo "Creating ZIP: $zip_name"
|
|
|
- zip -r -9 "$zip_name" "$dir"
|
|
|
+ # Create ZIP file with the artifact name
|
|
|
+ # The ZIP will contain all subfolders and subfiles from the artifact
|
|
|
+ cd "$artifact_dir"
|
|
|
+ zip -r "../../${artifact_name}.zip" . -x "*.git*"
|
|
|
+ cd - > /dev/null
|
|
|
+
|
|
|
+ echo "Created ZIP: ${artifact_name}.zip"
|
|
|
|
|
|
# Upload to release
|
|
|
- echo "Uploading $zip_name to release ${{ env.RELEASE_TAG }}..."
|
|
|
- if gh release upload ${{ env.RELEASE_TAG }} "$zip_name" --clobber; then
|
|
|
- echo "✅ Successfully uploaded: $zip_name"
|
|
|
- uploaded_count=$((uploaded_count + 1))
|
|
|
- else
|
|
|
- echo "❌ Failed to upload: $zip_name"
|
|
|
- fi
|
|
|
+ echo "Uploading ${artifact_name}.zip to release ${{ steps.get_release.outputs.tag }}..."
|
|
|
+ gh release upload "${{ steps.get_release.outputs.tag }}" "${artifact_name}.zip" --clobber --repo ${{ github.repository }}
|
|
|
|
|
|
- # Clean up ZIP file
|
|
|
- rm -f "$zip_name"
|
|
|
+ echo "Successfully uploaded: ${artifact_name}.zip"
|
|
|
fi
|
|
|
done
|
|
|
|
|
|
- echo "Upload complete: $uploaded_count artifacts uploaded to release ${{ env.RELEASE_TAG }}"
|
|
|
+ echo "All AnyKernel3 artifacts have been processed and uploaded!"
|
|
|
+
|
|
|
+ # Show final summary
|
|
|
+ echo "## Upload Summary" >> $GITHUB_STEP_SUMMARY
|
|
|
+ echo "| Artifact | Status |" >> $GITHUB_STEP_SUMMARY
|
|
|
+ echo "|----------|--------|" >> $GITHUB_STEP_SUMMARY
|
|
|
+
|
|
|
+ for artifact_dir in ./downloaded-artifacts/*/; do
|
|
|
+ if [ -d "$artifact_dir" ]; then
|
|
|
+ artifact_name=$(basename "$artifact_dir")
|
|
|
+ echo "| ${artifact_name}.zip | ✅ Uploaded |" >> $GITHUB_STEP_SUMMARY
|
|
|
+ fi
|
|
|
+ done
|
|
|
|
|
|
- name: Summary
|
|
|
run: |
|