Skip to content

Commit 53d68cc

Browse files
committed
update create tar file using a temp dir
1 parent 423c247 commit 53d68cc

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

.github/workflows/s3-action.yaml

+14-3
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,22 @@ jobs:
5353
5454
- name: Create Tarball
5555
run: |
56-
tar --exclude="./.git" --exclude="./node_modules" --ignore-failed-read -czf "$TARBALL_NAME" ./
56+
# Create a temporary directory
57+
TEMP_DIR=$(mktemp -d)
58+
59+
# Copy everything except .git and node_modules to the temp directory
60+
rsync -a --exclude=".git" --exclude="node_modules" ./ "$TEMP_DIR/"
61+
62+
# Navigate to the temp directory and create the tarball
63+
cd "$TEMP_DIR"
64+
tar --ignore-failed-read -czf "$GITHUB_WORKSPACE/$TARBALL_NAME" ./
65+
66+
# Clean up the temporary directory
67+
rm -rf "$TEMP_DIR"
5768
5869
- name: Upload Tarball to S3
5970
run: |
60-
aws s3 cp "$TARBALL_NAME" "s3://$AWS_S3_BUCKET/create-hyperweb-app/$TARBALL_NAME" --acl public-read
71+
aws s3 cp "$GITHUB_WORKSPACE/$TARBALL_NAME" "s3://$AWS_S3_BUCKET/create-hyperweb-app/$TARBALL_NAME" --acl public-read
6172
echo "Tarball uploaded: https://$AWS_S3_BUCKET.s3.amazonaws.com/create-hyperweb-app/$TARBALL_NAME"
6273
env:
6374
AWS_DEFAULT_REGION: 'us-east-1'
@@ -68,7 +79,7 @@ jobs:
6879
- name: Update latest.tar.gz (Only on Main)
6980
if: github.ref == 'refs/heads/main'
7081
run: |
71-
aws s3 cp "$TARBALL_NAME" "s3://$AWS_S3_BUCKET/create-hyperweb-app/latest.tar.gz" --acl public-read
82+
aws s3 cp "$GITHUB_WORKSPACE/$TARBALL_NAME" "s3://$AWS_S3_BUCKET/create-hyperweb-app/latest.tar.gz" --acl public-read
7283
echo "Latest tarball updated: https://$AWS_S3_BUCKET.s3.amazonaws.com/create-hyperweb-app/latest.tar.gz"
7384
env:
7485
AWS_DEFAULT_REGION: 'us-east-1'

0 commit comments

Comments
 (0)