Skip to content

Commit

Permalink
Modifying push-to-main workflow action
Browse files Browse the repository at this point in the history
  • Loading branch information
ammont82 committed Oct 7, 2024
1 parent 55a7e43 commit 8e62f8b
Showing 1 changed file with 8 additions and 51 deletions.
59 changes: 8 additions & 51 deletions .github/workflows/push-to-main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,54 +34,11 @@ jobs:
- name: Rename bundle
run: mv apps/agent/dist/*.tgz apps/agent/dist/agent-${{ github.sha }}.tgz

- name: Upload TGZ as artifact
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
artifact_name="agent-${{ github.sha }}.tgz"
artifact_path="apps/agent/dist/$artifact_name"
# Verify file exists
if [ ! -f "$artifact_path" ]; then
echo "Error: File $artifact_path does not exist"
exit 1
fi
# Create a new artifact
response=$(curl -sS -X POST \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/${{ github.repository }}/actions/artifacts" \
-d "{\"name\":\"$artifact_name\",\"retention_days\":1}")
echo "API Response: $response"
# Check for errors in the response
if echo "$response" | jq -e '.message' > /dev/null; then
echo "Error from GitHub API: $(echo "$response" | jq -r '.message')"
exit 1
fi
upload_url=$(echo "$response" | jq -r '.upload_url')
if [ -z "$upload_url" ] || [ "$upload_url" = "null" ]; then
echo "Error: Failed to get upload URL from GitHub API"
exit 1
fi
# Upload the artifact
upload_response=$(curl -sS -X PUT \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type: application/gzip" \
-T "$artifact_path" \
"$upload_url")
echo "Upload Response: $upload_response"
# Check for errors in the upload response
if echo "$upload_response" | jq -e '.message' > /dev/null; then
echo "Error uploading artifact: $(echo "$upload_response" | jq -r '.message')"
exit 1
fi
echo "Artifact $artifact_name uploaded successfully"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: agent-${{ github.sha }}.tgz
path: apps/agent/dist/agent-${{ github.sha }}.tgz
if-no-files-found: error
retention-days: 1
compression-level: 0

0 comments on commit 8e62f8b

Please sign in to comment.