Skip to content

Commit 2a7dce3

Browse files
committed
🐛 Fix: build script
1 parent 28930ee commit 2a7dce3

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@ permissions:
1111
contents: write
1212
pages: write
1313
id-token: write
14-
security-events: write # Required for security scanning
14+
security-events: write
1515

16-
# Cancel in-progress runs for pull requests
1716
concurrency:
1817
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
1918
cancel-in-progress: true
@@ -30,6 +29,9 @@ jobs:
3029
with:
3130
languages: javascript, typescript
3231

32+
- name: Autobuild
33+
uses: github/codeql-action/autobuild@v2
34+
3335
- name: Perform CodeQL Analysis
3436
uses: github/codeql-action/analyze@v2
3537

@@ -44,29 +46,28 @@ jobs:
4446
- name: Setup Node.js
4547
uses: actions/setup-node@v3
4648
with:
47-
node-version: '18'
49+
node-version: '20'
4850
cache: 'npm'
4951

50-
# Cache build outputs
5152
- name: Cache build
5253
uses: actions/cache@v3
5354
with:
5455
path: |
5556
dist
56-
.cache
57-
key: ${{ runner.os }}-build-${{ hashFiles('**/package-lock.json') }}
57+
node_modules/.cache
58+
key: ${{ runner.os }}-build-${{ hashFiles('**/package-lock.json', '**/src/**') }}
5859
restore-keys: |
5960
${{ runner.os }}-build-
6061
6162
- name: Install Dependencies
6263
run: |
6364
npm ci
65+
npm install -g html-minifier-terser svgo
6466
if [ $? -ne 0 ]; then
6567
echo "::error::Failed to install dependencies"
6668
exit 1
6769
fi
6870
69-
# Validate environment variables
7071
- name: Validate Environment
7172
run: |
7273
if [ -z "${{ secrets.ESHANIZED_GH_TOKEN }}" ]; then
@@ -85,11 +86,10 @@ jobs:
8586
DEPLOY_TARGET: github
8687
NODE_ENV: production
8788

88-
# Optimize build output
8989
- name: Optimize Assets
9090
run: |
91-
npx html-minifier-terser --input-dir dist --output-dir dist --file-ext html --collapse-whitespace --remove-comments
92-
npx svgo -f dist -r
91+
html-minifier-terser --input-dir dist --output-dir dist --file-ext html --collapse-whitespace --remove-comments
92+
svgo -f dist -r
9393
9494
- name: Deploy to GitHub Pages
9595
uses: peaceiris/actions-gh-pages@v3
@@ -104,11 +104,11 @@ jobs:
104104
full_commit_message: 'Deploy to GitHub Pages from @ ${{ github.sha }}'
105105

106106
- name: Report Status
107-
if: always()
107+
if: always() && github.event_name == 'pull_request'
108108
uses: actions/github-script@v6
109109
with:
110110
script: |
111-
const { job, conclusion } = context;
111+
const { conclusion } = context;
112112
const message = conclusion === 'success'
113113
? '✅ Deployment successful'
114114
: '❌ Deployment failed';

0 commit comments

Comments
 (0)