Skip to content

Commit 5e5ef47

Browse files
authored
Update deploy.yml
1 parent 94f9576 commit 5e5ef47

File tree

1 file changed

+19
-44
lines changed

1 file changed

+19
-44
lines changed

.github/workflows/deploy.yml

Lines changed: 19 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: Deploy
33
on:
44
push:
55
branches: ['develop', 'main']
6+
67
permissions:
78
contents: write
89

@@ -21,65 +22,44 @@ jobs:
2122
- uses: actions/checkout@v4
2223
with:
2324
fetch-depth: 0
25+
2426
- name: Promote develop → main (fast-forward only)
2527
id: promote
26-
env:
27-
GH_USER_NAME: github-actions[bot]
28-
GH_USER_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com
2928
run: |
3029
set -euo pipefail
31-
git config user.name "$GH_USER_NAME"
32-
git config user.email "$GH_USER_EMAIL"
33-
30+
git config user.name "github-actions[bot]"
31+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
3432
git fetch origin main develop
35-
3633
BEFORE="$(git rev-parse origin/main)"
3734
git checkout -B main origin/main
38-
3935
git merge --ff-only origin/develop
40-
4136
AFTER="$(git rev-parse HEAD)"
42-
4337
if [ "$BEFORE" = "$AFTER" ]; then
44-
echo "No changes to promote. main already up to date."
4538
echo "changed=false" >> "$GITHUB_OUTPUT"
4639
echo "new_sha=$AFTER" >> "$GITHUB_OUTPUT"
4740
exit 0
4841
fi
49-
5042
git push origin main
5143
echo "changed=true" >> "$GITHUB_OUTPUT"
5244
echo "new_sha=$AFTER" >> "$GITHUB_OUTPUT"
5345
5446
- uses: actions/setup-node@v4
5547
if: ${{ steps.promote.outputs.changed == 'true' }}
5648
with:
57-
node-version: 20
58-
registry-url: 'https://registry.npmjs.org'
59-
49+
node-version: 20
50+
registry-url: 'https://registry.npmjs.org'
51+
cache: 'npm'
52+
cache-dependency-path: 'package-lock.json'
53+
6054
- name: Force npmjs registry
6155
if: ${{ steps.promote.outputs.changed == 'true' }}
6256
run: |
6357
npm config set registry https://registry.npmjs.org/
6458
echo "registry=https://registry.npmjs.org/" > ~/.npmrc
6559
66-
- uses: pnpm/action-setup@v4
67-
if: ${{ steps.promote.outputs.changed == 'true' }}
68-
with:
69-
version: 10
70-
standalone: true
71-
72-
73-
- run: pnpm -v
74-
if: ${{ steps.promote.outputs.changed == 'true' }}
75-
76-
- uses: actions/setup-node@v4
60+
- name: Install dependencies
7761
if: ${{ steps.promote.outputs.changed == 'true' }}
78-
with:
79-
node-version: 20
80-
cache: 'pnpm'
81-
cache-dependency-path: 'pnpm-lock.yaml'
82-
62+
run: npm ci
8363

8464
- name: Install Vercel CLI
8565
if: ${{ steps.promote.outputs.changed == 'true' }}
@@ -103,42 +83,37 @@ jobs:
10383
url="$(vercel deploy --prebuilt --prod --token='${{ secrets.VERCEL_TOKEN }}')"
10484
echo "::notice::Deployed $url"
10585
106-
10786
deploy-on-main:
10887
if: ${{ github.ref == 'refs/heads/main' }}
10988
runs-on: ubuntu-latest
11089
steps:
11190
- uses: actions/checkout@v4
91+
11292
- uses: actions/setup-node@v4
11393
with:
11494
node-version: 20
11595
registry-url: 'https://registry.npmjs.org'
96+
cache: 'npm'
97+
cache-dependency-path: 'package-lock.json'
11698

11799
- name: Force npmjs registry
118100
run: |
119101
npm config set registry https://registry.npmjs.org/
120102
echo "registry=https://registry.npmjs.org/" > ~/.npmrc
121103
122-
123-
- uses: pnpm/action-setup@v4
124-
with:
125-
version: 10
126-
standalone: true
127-
- run: pnpm -v
128-
129-
- uses: actions/setup-node@v4
130-
with:
131-
node-version: 20
132-
cache: 'pnpm'
133-
cache-dependency-path: 'pnpm-lock.yaml'
104+
- name: Install dependencies
105+
run: npm ci
134106

135107
- run: npm i -g vercel@latest
108+
136109
- name: Pull Vercel Env (production)
137110
env:
138111
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
139112
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
140113
run: vercel pull --yes --environment=production --token='${{ secrets.VERCEL_TOKEN }}'
114+
141115
- name: Build (prebuilt, prod)
142116
run: vercel build --prod --token='${{ secrets.VERCEL_TOKEN }}'
117+
143118
- name: Deploy (prod)
144119
run: vercel deploy --prebuilt --prod --token='${{ secrets.VERCEL_TOKEN }}'

0 commit comments

Comments
 (0)