Skip to content

please delete: pr pointed at incorrect upstream #2

please delete: pr pointed at incorrect upstream

please delete: pr pointed at incorrect upstream #2

Workflow file for this run

name: Deploy Pull Request to Ephemeral Railway Environment
on:
pull_request:
branches:
- main
types:
- opened
- synchronize
- reopened
- closed
jobs:
deploy:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || github.event.action != 'closed'
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Generate dynamic variables
id: generate-vars
run: |
# This is just a mock command. Replace with your actual command to generate variables.
echo "DYNAMIC_VAR=value123" >> $GITHUB_ENV
- name: Use Node 12
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Install packages
run: yarn install --frozen-lockfile
- name: Run tests
run: yarn test
- name: Install Railway
run: npm i -g @railway/cli
- name: Authenticate with Railway
run: |
echo "${{ secrets.RAILWAY_TOKEN }}" | railway login
- name: Create or Get Ephemeral Environment
id: create-env
run: |
ENV_NAME="pr-${{ github.event.pull_request.number }}"
railway environments create $ENV_NAME || true
- name: Set Environment Variable for Ephemeral Environment
run: |
ENV_NAME="pr-${{ github.event.pull_request.number }}"
# Replace VAR_NAME and VAR_VALUE with your actual variable name and value
railway variables set DYNAMIC_VAR=${{ env.DYNAMIC_VAR }} -e $ENV_NAME
- name: Deploy to Ephemeral Environment
run: |
railway up -e "pr-${{ github.event.pull_request.number }}"
cleanup:
if: github.event_name == 'pull_request' && github.event.action == 'closed'
runs-on: ubuntu-latest
steps:
- name: Use Node 12
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Install packages
run: yarn install --frozen-lockfile
- name: Run tests
run: yarn test
- name: Install Railway
run: npm i -g @railway/cli
- name: Authenticate with Railway
run: |
echo "${{ secrets.RAILWAY_TOKEN }}" | railway login
- name: Destroy Ephemeral Environment
run: |
railway environments destroy "pr-${{ github.event.pull_request.number }}" --yes