Skip to content

Commit 3c304d2

Browse files
committed
fix railway deploy watch-path match
1 parent 04e33e5 commit 3c304d2

2 files changed

Lines changed: 23 additions & 7 deletions

File tree

.github/workflows/deploy-railway-app.yml

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ jobs:
2626
runs-on: ubuntu-latest
2727
timeout-minutes: 30
2828
env:
29-
# Railway CLI expects account/workspace tokens in RAILWAY_API_TOKEN.
29+
# Keep both names because Railway CLI behavior varies across versions.
30+
RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }}
3031
RAILWAY_API_TOKEN: ${{ secrets.RAILWAY_TOKEN }}
3132
RAILWAY_PROJECT_ID: ${{ secrets.RAILWAY_PROJECT_ID }}
3233
RAILWAY_ENVIRONMENT_ID: ${{ secrets.RAILWAY_ENVIRONMENT_ID }}
@@ -35,7 +36,7 @@ jobs:
3536
steps:
3637
- name: Validate Railway secrets
3738
run: |
38-
test -n "${RAILWAY_API_TOKEN}" || (echo "Missing secret: RAILWAY_TOKEN" && exit 1)
39+
test -n "${RAILWAY_TOKEN}" || (echo "Missing secret: RAILWAY_TOKEN" && exit 1)
3940
test -n "${RAILWAY_PROJECT_ID}" || (echo "Missing secret: RAILWAY_PROJECT_ID" && exit 1)
4041
test -n "${RAILWAY_ENVIRONMENT_ID}" || (echo "Missing secret: RAILWAY_ENVIRONMENT_ID" && exit 1)
4142
test -n "${RAILWAY_SERVICE_ID}" || (echo "Missing secret: RAILWAY_SERVICE_ID" && exit 1)
@@ -59,8 +60,22 @@ jobs:
5960
6061
- name: Deploy to Railway (CI mode)
6162
run: |
62-
railway up \
63-
--ci \
64-
--project "${RAILWAY_PROJECT_ID}" \
65-
--environment "${RAILWAY_ENVIRONMENT_ID}" \
66-
--service "${RAILWAY_SERVICE_ID}"
63+
# Railway builder failures can be transient (container bootstrap/network).
64+
# Retry the deploy to reduce false-negative workflow failures.
65+
for attempt in 1 2 3; do
66+
echo "Railway deploy attempt ${attempt}/3"
67+
if railway up \
68+
--ci \
69+
--project "${RAILWAY_PROJECT_ID}" \
70+
--environment "${RAILWAY_ENVIRONMENT_ID}" \
71+
--service "${RAILWAY_SERVICE_ID}"; then
72+
echo "Railway deploy succeeded."
73+
exit 0
74+
fi
75+
if [ "${attempt}" -lt 3 ]; then
76+
echo "Deploy attempt ${attempt} failed. Retrying in 20s..."
77+
sleep 20
78+
fi
79+
done
80+
echo "Railway deploy failed after 3 attempts."
81+
exit 1

.railwayignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ web/test-results/
2222
# Local/editor files
2323
.env
2424
.env.*
25+
!.env.example
2526
*.local
2627
*.swp
2728
*.tmp

0 commit comments

Comments
 (0)