Skip to content

Commit 20ed877

Browse files
Update deploy.yml
1 parent 23a877c commit 20ed877

File tree

1 file changed

+27
-3
lines changed

1 file changed

+27
-3
lines changed

.github/workflows/deploy.yml

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,41 @@ jobs:
2424
- name: Fetch deployment branch
2525
run: git fetch origin deployment:deployment
2626

27-
- name: Attempt merge
27+
- name: Attempt merge and resolve package conflicts
2828
id: merge_attempt
2929
run: |
3030
git checkout deployment
31-
git merge origin/main --no-edit || echo "MERGE_FAILED=true" >> $GITHUB_ENV
32-
31+
# Attempt merge
32+
if ! git merge origin/main --no-edit; then
33+
# If merge fails due to package conflicts, reset and reinstall
34+
echo "MERGE_FAILED=true" >> $GITHUB_ENV
35+
exit 0
36+
fi
37+
38+
# After successful merge, ensure package consistency
39+
echo "Ensuring package consistency..."
40+
rm -rf node_modules/ package-lock.json
41+
npm install
42+
git add package-lock.json
43+
git commit -m "Update package-lock.json after merge" || echo "No package-lock changes"
44+
3345
- name: Push to deployment branch
3446
if: env.MERGE_FAILED != 'true'
3547
run: |
3648
git push origin deployment
3749
50+
- name: Set up Node.js
51+
if: env.MERGE_FAILED != 'true'
52+
uses: actions/setup-node@v3
53+
with:
54+
node-version: '22'
55+
cache: 'npm'
56+
57+
- name: Install dependencies
58+
if: env.MERGE_FAILED != 'true'
59+
run: |
60+
npm ci # Uses package-lock.json for exact versions
61+
3862
- name: Deploy to Fly.io
3963
if: env.MERGE_FAILED != 'true'
4064
uses: superfly/flyctl-actions@1.4

0 commit comments

Comments
 (0)