Skip to content

fix: compare changes to target branch #16

fix: compare changes to target branch

fix: compare changes to target branch #16

Workflow file for this run

name: Deploy
on:
push:
branches: [dev, main, feat/parallel-deploy]
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'
environment:
runs-on: ubuntu-latest
outputs:
environment: ${{ steps.env.outputs.environment }}
steps:
- 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
deploy-triggers:
runs-on: ubuntu-latest
needs: [changes, environment]
if: ${{ needs.changes.outputs.triggers == 'true' }}
container: ghcr.io/railwayapp/cli:latest
environment: ${{ needs.environment.outputs.environment }}
env:
RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }}
steps:
- uses: actions/checkout@v3
- name: Deploy triggers
# run: railway up -s logic-system -e ${{ needs.environment.outputs.environment }} --ci
run: echo "logic-system -e ${{ needs.environment.outputs.environment }} --ci"
deploy-subscriptions:
runs-on: ubuntu-latest
needs: [changes, environment]
if: ${{ needs.changes.outputs.subscriptions == 'true' }}
container: ghcr.io/railwayapp/cli:latest
environment: ${{ needs.environment.outputs.environment }}
env:
RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }}
steps:
- uses: actions/checkout@v3
- name: Deploy subscriptions
run: echo "subscription-server -e ${{ needs.environment.outputs.environment }} --ci"
# run: railway up -s subscription-server -e ${{ needs.environment.outputs.environment }} --ci
deploy-dispatcher:
runs-on: ubuntu-latest
needs: [changes, environment, deploy-subscriptions]
if: ${{ always() && (needs.changes.outputs.dispatcher == 'true' || needs.changes.outputs.subscriptions == 'true') }}
container: ghcr.io/railwayapp/cli:latest
environment: ${{ needs.environment.outputs.environment }}
env:
RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }}
steps:
- uses: actions/checkout@v3
- name: Deploy dispatcher
run: echo "dispatcher -e ${{ needs.environment.outputs.environment }} --ci"
# run: railway up -s dispatcher -e ${{ needs.environment.outputs.environment }} --ci
deploy-consumers:
runs-on: ubuntu-latest
needs: [changes, environment]
if: ${{ needs.changes.outputs.consumers == 'true' }}
container: ghcr.io/railwayapp/cli:latest
environment: ${{ needs.environment.outputs.environment }}
env:
RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }}
steps:
- uses: actions/checkout@v3
- name: Deploy consumers
run: echo "consumer-telegram -e ${{ needs.environment.outputs.environment }} --ci"
# run: railway up -s consumer-telegram -e ${{ needs.environment.outputs.environment }} --ci