Skip to content

Commit d43c3d8

Browse files
committed
feat: enhance GitHub Actions workflow to prepare and compress production package for release
1 parent feaf1c5 commit d43c3d8

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

.github/workflows/release.yml

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,29 @@ jobs:
4141
run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
4242

4343
- name: Build with Next.js
44-
run: ${{ steps.detect-package-manager.outputs.runner }} next build
44+
run: ${{ steps.detect-package-manager.outputs.runner }} build
4545

4646
- name: Get version from package.json
4747
id: get_version
4848
run: |
4949
VERSION=$(jq -r '.version' package.json)
5050
echo "VERSION=$VERSION" >> $GITHUB_ENV
5151
52+
- name: Prepare production package
53+
run: |
54+
mkdir production
55+
cp -R .next production/
56+
cp package.json production/
57+
[ -f yarn.lock ] && cp yarn.lock production/ || true
58+
[ -f package-lock.json ] && cp package-lock.json production/ || true
59+
[ -f next.config.js ] && cp next.config.js production/ || true
60+
[ -d public ] && cp -R public production/ || true
61+
[ -f example.env ] && cp example.env production/ || true
62+
63+
- name: Compress production package
64+
run: |
65+
tar --exclude='./node_modules' --exclude='./.git' -czf production.tar.gz production
66+
5267
- name: Create Release
5368
id: create_release
5469
uses: actions/create-release@v1
@@ -66,6 +81,6 @@ jobs:
6681
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6782
with:
6883
upload_url: ${{ steps.create_release.outputs.upload_url }}
69-
asset_path: ./path/to/your/build/artifact.zip
70-
asset_name: artifact.zip
71-
asset_content_type: application/zip
84+
asset_path: production.tar.gz
85+
asset_name: production.tar.gz
86+
asset_content_type: application/gzip

0 commit comments

Comments
 (0)