-
Notifications
You must be signed in to change notification settings - Fork 1
62 lines (59 loc) · 2.23 KB
/
deploy.yaml
File metadata and controls
62 lines (59 loc) · 2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: Deploy
on:
push:
branches: [dev, main]
jobs:
changes:
runs-on: ubuntu-latest
outputs:
triggers: ${{ steps.filter.outputs.triggers }}
dispatcher: ${{ steps.filter.outputs.dispatcher }}
subscriptions: ${{ steps.filter.outputs.subscriptions }}
consumers: ${{ steps.filter.outputs.consumers }}
steps:
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
id: filter
with:
base: ${{ github.ref_name }}
filters: |
triggers:
- 'apps/logic-system/src/**/*.ts'
- 'packages/**/*.ts'
dispatcher:
- 'apps/dispatcher/src/**/*.ts'
- 'packages/**/*.ts'
subscriptions:
- 'apps/subscription-server/src/**/*.ts'
consumers:
- 'apps/consumers/src/**/*.ts'
- 'packages/**/*.ts'
deploy:
runs-on: ubuntu-latest
needs: changes
container: ghcr.io/railwayapp/cli:latest
environment: ${{ github.ref == 'refs/heads/main' && 'production' || 'dev' }}
env:
RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }}
steps:
- uses: actions/checkout@v3
- name: Determine environment
id: env
run: |
if [[ "${{ github.ref }}" == "refs/heads/main" || "${{ github.base_ref }}" == "main" ]]; then
echo "environment=production" >> $GITHUB_OUTPUT
else
echo "environment=dev" >> $GITHUB_OUTPUT
fi
- name: Deploy triggers
if: ${{ needs.changes.outputs.triggers == 'true' }}
run: railway up -s logic-system -e ${{ steps.env.outputs.environment }} --ci
- name: Deploy subscriptions
if: ${{ needs.changes.outputs.subscriptions == 'true' }}
run: railway up -s subscription-server -e ${{ steps.env.outputs.environment }} --ci
- name: Deploy dispatcher
if: ${{ needs.changes.outputs.dispatcher == 'true' || needs.changes.outputs.subscriptions == 'true' }}
run: railway up -s dispatcher -e ${{ steps.env.outputs.environment }} --ci
- name: Deploy consumers
if: ${{ needs.changes.outputs.consumers == 'true' }}
run: railway up -s consumer-telegram -e ${{ steps.env.outputs.environment }} --ci