7 months ago
Problem:
My team was previously using this manual github action https://github.com/Faolain/railway-pr-deploy/blob/main/index.js in order to orchestrate ephemeral PRs where we depend on services outside of Railway. In short, we would use third party services like neon where we would pass along the newly created `db_url`, within a github action,l to a newly cloned railway environment which branched off of staging. This way, all environments would be branched off of staging, ephemerally created and upon any update to the github branch, the deployed railway environment would be updated with the new code. The manual github action also handles this. However upon recent Railway API updates, this functionality has now been broken (among others). I was advised to update to use the railway cli
- name: Create Railway env (multi-vars)
env:
DB_URL: >-
postgresql+asyncpg://${{ secrets.NEON_USERNAME }}:
${{ steps.create_branch.outputs.password }}
@${{ steps.create_branch.outputs.db_host }}/postgresql
run: |
railway environment new pr-${{ github.event.pull_request.number }} \
--copy "${{ env.DUPLICATE_FROM_ID }}" \
-v "${{ env.SERVICE_ID }}" "DATABASE_URL=${{ env.DB_URL }}" \
-v "${{ env.SERVICE_ID }}" "APP_ENVIRONMENT=pr-preview" \
-v "${{ env.SERVICE_ID }}" "LOG_DD_AGENT_HOST="
but there is currently no way to pass the deployment trigger to the particular serviceID.
Solution/User Story
We would want to be able to pass in the deploymentTrigger aka the github branch(aka this line which previously worked using the Railway API https://github.com/Faolain/railway-pr-deploy/blob/main/index.js#L129 ) for each service_id as a flag within the CLI so that the environment that gets created uses the branch provided as the source code and source for all future updates.
0 Threads mention this feature
0 Replies