From aa500672055dc2b8beb8da1fcf9a88126fdb9730 Mon Sep 17 00:00:00 2001 From: Mihovil Ilakovac Date: Mon, 3 Nov 2025 13:02:20 +0100 Subject: [PATCH 1/7] Add Railway deployment support alongside Fly.io MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR adds Railway as a deployment platform option while maintaining backward compatibility with Fly.io deployments. ## Changes ### action.yml - Add `platform` input (required): Choose 'fly' or 'railway' - Add Railway-specific inputs: - `railway-token`: Railway API token - `project-name`: Railway project name (max 25 chars) - `railway-workspace`: Optional workspace ID for multi-workspace accounts - Update action metadata to reflect dual platform support - Add conditional CLI installation (Flyctl for Fly, Railway CLI via npm for Railway) - Add conditional deployment steps for each platform - Improve bash variable handling in deployment commands ### README.md - Add TODO comments for documentation sections - Structure for both Fly.io and Railway setup instructions - Placeholder for platform comparison table - Breaking change notice for existing users ## Breaking Changes ⚠️ Existing users must add `platform: fly` to their workflow configuration ## Notes - Follows GitHub Actions patterns (no manual input validation) - Railway CLI installed via npm install -g @railway/cli - Based on Wasp Railway deployment patterns from wasp-lang/wasp#3157 🤖 Generated with Claude Code Co-Authored-By: Claude --- README.md | 103 ++++++++++++++++++++++++++++++++++++----------------- action.yml | 61 +++++++++++++++++++++++++++---- 2 files changed, 124 insertions(+), 40 deletions(-) diff --git a/README.md b/README.md index 3087ea3..e10f234 100644 --- a/README.md +++ b/README.md @@ -1,45 +1,63 @@ # deploy-action 🚀 -Github Action to deploy with Wasp to Fly.io + -## How to setup Deploy on Push + -### Launch your app locally once ⚠️ +## Deploying to Fly.io -- You should first launch your app locally with `wasp deploy fly launch `. -- After your app is launched, make sure to commit the `fly-server.toml` and `fly-client.toml` files. + -### Action Inputs - -#### Get your API token from Fly.io - -- Login with Fly.io and go here: https://fly.io/user/personal_access_tokens -- Click `Create token` and copy that value. -- Add your Fly.io token as a repository secret e.g. calling it `FLY_TOKEN` - - Read more about how to do it: https://docs.github.com/en/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository - -#### Setting a Custom Server URL - -If you have configured a custom domain for your server, you can specify it as a repository secret named `SERVER_URL`. If this is not defined, Wasp will default to using the `-server.fly.dev` address. - -For detailed instructions on setting up repository secrets, visit: [GitHub Docs: Creating Encrypted Secrets for a Repository](https://docs.github.com/en/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository). + -### Add the Action to your repo +## Deploying to Railway -Create a file called `deploy.yml` in `.github/workflows` folder in your repo with this content: + + + +## Action Inputs + + + +## Breaking Changes + + diff --git a/action.yml b/action.yml index b6510ca..40fb7d4 100644 --- a/action.yml +++ b/action.yml @@ -1,9 +1,21 @@ name: "Wasp Deploy" -description: "Deploy with Wasp to Fly.io" +description: "Deploy with Wasp to Fly.io or Railway" inputs: - fly-token: - description: "Fly.io API token" + platform: + description: "Deployment platform: 'fly' or 'railway'" required: true + fly-token: + description: "Fly.io API token (required when platform is 'fly')" + required: false + railway-token: + description: "Railway API token (required when platform is 'railway')" + required: false + project-name: + description: "Project/app name (required for Railway, max 25 characters)" + required: false + railway-workspace: + description: "Railway workspace ID (optional, for multi-workspace accounts)" + required: false server-url: description: "Server URL for the React app" required: false @@ -14,6 +26,7 @@ runs: using: "composite" steps: - uses: actions/checkout@v4 + - name: Install Wasp shell: bash run: | @@ -24,14 +37,48 @@ runs: curl -sSL https://get.wasp.sh/installer.sh | sh -s -- $VERSION_PARAM - name: Install Flyctl + if: ${{ inputs.platform == 'fly' }} uses: superfly/flyctl-actions/setup-flyctl@master - - name: Deploy + + - name: Install Railway CLI + if: ${{ inputs.platform == 'railway' }} + shell: bash + run: | + npm install -g @railway/cli + railway --version + + - name: Deploy to Fly.io + if: ${{ inputs.platform == 'fly' }} + shell: bash run: | - if [ -n "${{ inputs.server-url }}" ]; then - REACT_APP_API_URL=${{ inputs.server-url }} wasp deploy fly deploy + SERVER_URL="${{ inputs.server-url }}" + if [ -n "$SERVER_URL" ]; then + REACT_APP_API_URL="$SERVER_URL" wasp deploy fly deploy else wasp deploy fly deploy fi - shell: bash env: FLY_API_TOKEN: ${{ inputs.fly-token }} + + - name: Deploy to Railway + if: ${{ inputs.platform == 'railway' }} + shell: bash + run: | + # For Railway accounts with multiple workspaces, specify which one to use + WORKSPACE_ARG="" + RAILWAY_WORKSPACE="${{ inputs.railway-workspace }}" + if [ -n "$RAILWAY_WORKSPACE" ]; then + WORKSPACE_ARG="--workspace $RAILWAY_WORKSPACE" + fi + + SERVER_URL="${{ inputs.server-url }}" + PROJECT_NAME="${{ inputs.project-name }}" + + # Note: WORKSPACE_ARG is intentionally unquoted to allow optional flag expansion + if [ -n "$SERVER_URL" ]; then + REACT_APP_API_URL="$SERVER_URL" wasp deploy railway deploy "$PROJECT_NAME" $WORKSPACE_ARG + else + wasp deploy railway deploy "$PROJECT_NAME" $WORKSPACE_ARG + fi + env: + RAILWAY_API_TOKEN: ${{ inputs.railway-token }} From a28dd8f366e69f06346d966fcdd3eefda2896f65 Mon Sep 17 00:00:00 2001 From: Mihovil Ilakovac Date: Mon, 3 Nov 2025 13:23:03 +0100 Subject: [PATCH 2/7] Update README --- README.md | 82 ++++++++++++++++++++++++++---------------------------- action.yml | 6 ++-- 2 files changed, 43 insertions(+), 45 deletions(-) diff --git a/README.md b/README.md index e10f234..cc84289 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,40 @@ # deploy-action 🚀 - +Github Action to deploy Wasp apps to Fly.io or Railway. - +Read more on each platform in our [docs](https://wasp.sh/docs/deployment/deployment-methods/wasp-deploy/overview). + +## Action Inputs + +### General + +- `platform` (required): 'fly' or 'railway' +- `server-url` (optional): If you have configured a custom domain for your server, provide its URL here. If this is not defined, Wasp will default to using the deployment URL provided by the platform. +- `wasp-version` (optional): Specific Wasp version to use, defaults to latest + +### Fly.io Specific + +- `fly-token` (required for Fly): Fly.io API token + +### Railway Specific + +- `railway-token` (required for Railway): Railway API token +- `project-name` (required for Railway): Project name, max 25 characters +- `railway-workspace-id` (optional): Railway workspace ID for multi-workspace accounts + +## Github Action Secrets + +For detailed instructions on setting up repository secrets, visit: [GitHub Docs: Creating Encrypted Secrets for a Repository](https://docs.github.com/en/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository). ## Deploying to Fly.io - +- Add token as repository secret called `FLY_TOKEN` + +### Example - ## Deploying to Railway - +- Get a Railway **project token** +- Add token as repository secret called `RAILWAY_TOKEN` +- Add Railway workspace ID as repository secret called `RAILWAY_WORKSPACE_ID` (optional, needed for multi-workspace accounts) + +### Getting the Railway Token + +### Example - - -## Action Inputs - - - -## Breaking Changes - - diff --git a/action.yml b/action.yml index 40fb7d4..983010c 100644 --- a/action.yml +++ b/action.yml @@ -13,11 +13,11 @@ inputs: project-name: description: "Project/app name (required for Railway, max 25 characters)" required: false - railway-workspace: + railway-workspace-id: description: "Railway workspace ID (optional, for multi-workspace accounts)" required: false server-url: - description: "Server URL for the React app" + description: "Server URL used by the React app" required: false wasp-version: description: "Version of Wasp to use for deployment" @@ -66,7 +66,7 @@ runs: run: | # For Railway accounts with multiple workspaces, specify which one to use WORKSPACE_ARG="" - RAILWAY_WORKSPACE="${{ inputs.railway-workspace }}" + RAILWAY_WORKSPACE="${{ inputs.railway-workspace-id }}" if [ -n "$RAILWAY_WORKSPACE" ]; then WORKSPACE_ARG="--workspace $RAILWAY_WORKSPACE" fi From c698504b6f1716d5268baca166b8cab98fc3efdd Mon Sep 17 00:00:00 2001 From: Mihovil Ilakovac Date: Mon, 3 Nov 2025 13:27:54 +0100 Subject: [PATCH 3/7] DRY code and update README --- README.md | 16 +++++++--------- action.yml | 31 +++++++++++++------------------ 2 files changed, 20 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index cc84289..d16350d 100644 --- a/README.md +++ b/README.md @@ -30,8 +30,8 @@ For detailed instructions on setting up repository secrets, visit: [GitHub Docs: - Prerequisites: Run `wasp deploy fly launch ` locally first - Commit the generated `fly-server.toml` and `fly-client.toml` files to repository -- Get Fly.io API token from https://fly.io/user/personal_access_tokens -- Add token as repository secret called `FLY_TOKEN` +- Add Github secrets: + - [Get Fly.io API token](https://fly.io/user/personal_access_tokens) and add it as repository secret called `FLY_TOKEN` ### Example @@ -58,14 +58,12 @@ jobs: ## Deploying to Railway -- Prerequisites: Run `wasp deploy railway launch ` locally first -- No configuration files to commit (Railway stores config on platform) -- Project name MUST be max 25 characters -- Get a Railway **project token** -- Add token as repository secret called `RAILWAY_TOKEN` -- Add Railway workspace ID as repository secret called `RAILWAY_WORKSPACE_ID` (optional, needed for multi-workspace accounts) +### Requirements -### Getting the Railway Token +- Prerequisites: Run `wasp deploy railway launch ` locally first +- Add Github secrets as below: + - Get a Railway **project token** and add it as repository secret called `RAILWAY_TOKEN` + - Add Railway workspace ID as repository secret called `RAILWAY_WORKSPACE_ID` (optional, needed for multi-workspace accounts) ### Example diff --git a/action.yml b/action.yml index 983010c..6cab55f 100644 --- a/action.yml +++ b/action.yml @@ -47,16 +47,17 @@ runs: npm install -g @railway/cli railway --version - - name: Deploy to Fly.io - if: ${{ inputs.platform == 'fly' }} + - name: Set custom server URL if provided shell: bash run: | - SERVER_URL="${{ inputs.server-url }}" - if [ -n "$SERVER_URL" ]; then - REACT_APP_API_URL="$SERVER_URL" wasp deploy fly deploy - else - wasp deploy fly deploy + if [ -n "${{ inputs.server-url }}" ]; then + echo "REACT_APP_API_URL=${{ inputs.server-url }}" >> $GITHUB_ENV fi + + - name: Deploy to Fly.io + if: ${{ inputs.platform == 'fly' }} + shell: bash + run: wasp deploy fly deploy env: FLY_API_TOKEN: ${{ inputs.fly-token }} @@ -64,21 +65,15 @@ runs: if: ${{ inputs.platform == 'railway' }} shell: bash run: | + PROJECT_NAME="${{ inputs.project-name }}" + # For Railway accounts with multiple workspaces, specify which one to use WORKSPACE_ARG="" - RAILWAY_WORKSPACE="${{ inputs.railway-workspace-id }}" - if [ -n "$RAILWAY_WORKSPACE" ]; then - WORKSPACE_ARG="--workspace $RAILWAY_WORKSPACE" + if [ -n "${{ inputs.railway-workspace-id }}" ]; then + WORKSPACE_ARG="--workspace ${{ inputs.railway-workspace-id }}" fi - SERVER_URL="${{ inputs.server-url }}" - PROJECT_NAME="${{ inputs.project-name }}" - # Note: WORKSPACE_ARG is intentionally unquoted to allow optional flag expansion - if [ -n "$SERVER_URL" ]; then - REACT_APP_API_URL="$SERVER_URL" wasp deploy railway deploy "$PROJECT_NAME" $WORKSPACE_ARG - else - wasp deploy railway deploy "$PROJECT_NAME" $WORKSPACE_ARG - fi + wasp deploy railway deploy "$PROJECT_NAME" $WORKSPACE_ARG env: RAILWAY_API_TOKEN: ${{ inputs.railway-token }} From b82503d0b40c5138a1a0a05fb2a56b2710334867 Mon Sep 17 00:00:00 2001 From: Mihovil Ilakovac Date: Mon, 3 Nov 2025 13:42:03 +0100 Subject: [PATCH 4/7] Add configurable Node.js version - Add node-version input (defaults to 22) - Setup Node.js before installing Wasp - Update README with node-version documentation --- README.md | 2 ++ action.yml | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/README.md b/README.md index d16350d..de92dee 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ Read more on each platform in our [docs](https://wasp.sh/docs/deployment/deploym ### General - `platform` (required): 'fly' or 'railway' +- `node-version` (optional): Node.js version to use, defaults to '22' - `server-url` (optional): If you have configured a custom domain for your server, provide its URL here. If this is not defined, Wasp will default to using the deployment URL provided by the platform. - `wasp-version` (optional): Specific Wasp version to use, defaults to latest @@ -52,6 +53,7 @@ jobs: with: platform: fly fly-token: ${{ secrets.FLY_TOKEN }} + node-version: "22" # Optional, defaults to 22 server-url: ${{ secrets.SERVER_URL }} # Optional wasp-version: "0.18.0" # Optional ``` diff --git a/action.yml b/action.yml index 6cab55f..ec6327d 100644 --- a/action.yml +++ b/action.yml @@ -22,11 +22,20 @@ inputs: wasp-version: description: "Version of Wasp to use for deployment" required: false + node-version: + description: "Node.js version to use" + required: false + default: "22" runs: using: "composite" steps: - uses: actions/checkout@v4 + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ inputs.node-version }} + - name: Install Wasp shell: bash run: | From cb5b956a996779bb34a48da4e94c89de314a0f0c Mon Sep 17 00:00:00 2001 From: Mihovil Ilakovac Date: Mon, 3 Nov 2025 13:52:44 +0100 Subject: [PATCH 5/7] Fix Railway deploy command - remove unsupported --workspace flag - Remove railway-workspace-id input (not supported by deploy command) - Simplify Railway deploy to just use project name - Update README to remove workspace references --- README.md | 5 +---- action.yml | 15 +-------------- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index de92dee..1569690 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,6 @@ Read more on each platform in our [docs](https://wasp.sh/docs/deployment/deploym - `railway-token` (required for Railway): Railway API token - `project-name` (required for Railway): Project name, max 25 characters -- `railway-workspace-id` (optional): Railway workspace ID for multi-workspace accounts ## Github Action Secrets @@ -63,9 +62,8 @@ jobs: ### Requirements - Prerequisites: Run `wasp deploy railway launch ` locally first -- Add Github secrets as below: +- Add Github secrets: - Get a Railway **project token** and add it as repository secret called `RAILWAY_TOKEN` - - Add Railway workspace ID as repository secret called `RAILWAY_WORKSPACE_ID` (optional, needed for multi-workspace accounts) ### Example @@ -87,7 +85,6 @@ jobs: platform: railway railway-token: ${{ secrets.RAILWAY_TOKEN }} project-name: my-app # Required, max 25 characters - railway-workspace-id: ${{ secrets.RAILWAY_WORKSPACE_ID }} # Optional server-url: ${{ secrets.SERVER_URL }} # Optional wasp-version: "0.18.0" # Optional ``` diff --git a/action.yml b/action.yml index ec6327d..a4c0d39 100644 --- a/action.yml +++ b/action.yml @@ -13,9 +13,6 @@ inputs: project-name: description: "Project/app name (required for Railway, max 25 characters)" required: false - railway-workspace-id: - description: "Railway workspace ID (optional, for multi-workspace accounts)" - required: false server-url: description: "Server URL used by the React app" required: false @@ -73,16 +70,6 @@ runs: - name: Deploy to Railway if: ${{ inputs.platform == 'railway' }} shell: bash - run: | - PROJECT_NAME="${{ inputs.project-name }}" - - # For Railway accounts with multiple workspaces, specify which one to use - WORKSPACE_ARG="" - if [ -n "${{ inputs.railway-workspace-id }}" ]; then - WORKSPACE_ARG="--workspace ${{ inputs.railway-workspace-id }}" - fi - - # Note: WORKSPACE_ARG is intentionally unquoted to allow optional flag expansion - wasp deploy railway deploy "$PROJECT_NAME" $WORKSPACE_ARG + run: wasp deploy railway deploy "${{ inputs.project-name }}" env: RAILWAY_API_TOKEN: ${{ inputs.railway-token }} From 1b3f101d0828008dcdf35791fcf49d396120c33d Mon Sep 17 00:00:00 2001 From: Mihovil Ilakovac Date: Mon, 3 Nov 2025 14:31:26 +0100 Subject: [PATCH 6/7] Fix Railway authentication - use RAILWAY_TOKEN env var Railway CLI expects RAILWAY_TOKEN not RAILWAY_API_TOKEN --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index a4c0d39..bc02070 100644 --- a/action.yml +++ b/action.yml @@ -72,4 +72,4 @@ runs: shell: bash run: wasp deploy railway deploy "${{ inputs.project-name }}" env: - RAILWAY_API_TOKEN: ${{ inputs.railway-token }} + RAILWAY_TOKEN: ${{ inputs.railway-token }} From 3579109137abc3718ec844fcb6afa7c10aee297e Mon Sep 17 00:00:00 2001 From: Mihovil Ilakovac Date: Mon, 3 Nov 2025 14:33:04 +0100 Subject: [PATCH 7/7] Revert to RAILWAY_API_TOKEN - Wasp uses this not RAILWAY_TOKEN --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index bc02070..a4c0d39 100644 --- a/action.yml +++ b/action.yml @@ -72,4 +72,4 @@ runs: shell: bash run: wasp deploy railway deploy "${{ inputs.project-name }}" env: - RAILWAY_TOKEN: ${{ inputs.railway-token }} + RAILWAY_API_TOKEN: ${{ inputs.railway-token }}