fix: inline manifest JSON into form args instead of uploading as separate file
This commit is contained in:
1 parent
c0356a26f6
commit
4d627e13b9
1 file changed
+7
-23
@@ -28,20 +28,14 @@ jobs:
|
|||||||
- name: Generate deployment manifest
|
- name: Generate deployment manifest
|
||||||
run: |
|
run: |
|
||||||
cd frontend/dist
|
cd frontend/dist
|
||||||
echo "{" > manifest.json
|
form_args="-F manifest={"
|
||||||
first=true
|
for file in $(find . -type f ! -name manifest.json | sed 's|^\./||'); do
|
||||||
for file in $(find . -type f | sed 's|^\./||'); do
|
|
||||||
hash=$(sha256sum "$file" | awk '{print $1}')
|
hash=$(sha256sum "$file" | awk '{print $1}')
|
||||||
if [ "$first" = true ]; then
|
form_args="$form_args\"$file\":\"$hash\","
|
||||||
first=false
|
|
||||||
else
|
|
||||||
echo "," >> manifest.json
|
|
||||||
fi
|
|
||||||
printf ' "%s": "%s"' "$file" "$hash" >> manifest.json
|
|
||||||
done
|
done
|
||||||
echo "" >> manifest.json
|
form_args="${form_args%,}}" # remove trailing comma and close JSON
|
||||||
echo "}" >> manifest.json
|
echo "Form arguments: $form_args"
|
||||||
echo "Generated manifest with $(grep -c ':' manifest.json) files"
|
echo "FORM_ARGS=$form_args" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Deploy to Cloudflare Pages
|
- name: Deploy to Cloudflare Pages
|
||||||
env:
|
env:
|
||||||
@@ -49,17 +43,7 @@ jobs:
|
|||||||
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
||||||
run: |
|
run: |
|
||||||
cd frontend/dist
|
cd frontend/dist
|
||||||
|
form_args="$FORM_ARGS" # use form arguments generated in previous step
|
||||||
# Build multipart form arguments from all files + manifest
|
|
||||||
form_args="-F manifest=@manifest.json"
|
|
||||||
for file in $(find . -type f ! -name manifest.json | sed 's|^\./||'); do
|
|
||||||
form_args="$form_args -F $file=@$file"
|
|
||||||
done
|
|
||||||
|
|
||||||
# print the form arguments for debugging
|
|
||||||
echo "Form arguments:"
|
|
||||||
echo "$form_args" | tr ' ' '\n' | sed 's/^/- /'
|
|
||||||
|
|
||||||
# Get short commit hash for deployment metadata
|
# Get short commit hash for deployment metadata
|
||||||
COMMIT_HASH=$(git rev-parse --short HEAD 2>/dev/null || echo "unknown")
|
COMMIT_HASH=$(git rev-parse --short HEAD 2>/dev/null || echo "unknown")
|
||||||
COMMIT_MSG=$(git log -1 --pretty=%B 2>/dev/null | head -1 || echo "Gitea Actions deploy")
|
COMMIT_MSG=$(git log -1 --pretty=%B 2>/dev/null | head -1 || echo "Gitea Actions deploy")
|
||||||
|
|||||||
Reference in new issue
Block a user