DEV Community

Olumide Nwosu
Olumide Nwosu

Posted on • Updated on

Automated Deployments for Node.js Apps with Github Actions and Railway

What I built

I built a task manager that helps keep track of your tasks. It helps to:

  • Users can create, edit, and delete tasks.
  • Users can assign tasks to themselves or to other users.
  • Users can view a list of all their tasks.
  • Users can view a list of all their tasks that are due today.
  • Users can view a list of all their tasks that are overdue.

Category Submission: DIY Deployments

App Link: Live Link

Screenshots

Documentation Image

Link to Documentation

Description

A Task Manager for keeping track of pending, in-progress, or completed tasks.

Link to Source Code

Code on GitHub

Permissive License

Link To License

Background (What made you decide to build this particular app? What inspired you?)

I recently started working with GitHub actions for continuous integration and I stumbled upon this hackathon. I saw this as opportunity to work on using Gihub Actions for Automatic deployments.

How I built it (How did you utilize GitHub Actions or GitHub Codespaces? Did you learn something new along the way? Pick up a new skill?)

I used GitHub for both Continuous Integration and Deployment/Delivery. As can be seen in the workflow file, main.yml, Github Actions helps to install dependencies, test the code, and push changes to the remote server. This saves developers the hassle of manual deployments and cuts delivery time considerably. It also helped me learn a new way to utilize Github actions the right way.

name: Node.js CI

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v3
      - name: Use Node.js 16
        uses: actions/setup-node@v3
        with:
          node-version: 16
          cache: 'npm'

      - name: Install Dependencies
        run: npm i

      - name: Run Tests
        run: npm t

      - name: Fix Linting Issues
        run: npm run lint:fix

      - name: Install Railway
        run: npm i -g @railway/cli

      - name: Deploy
        run: railway up
        env:
          RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }}
Enter fullscreen mode Exit fullscreen mode

A few reasons why this is helpful and should be normal practice are:

  • It provides faster feedback on code changes, allowing for issues to be caught and fixed earlier in the development process.
  • It improves the reliability of products by catching errors and bugs before they reach production.
  • It encourages collaboration between developers, testers, and other stakeholders, leading to a more effective development process.
  • It improves security by automatically running security tests and scans as part of the development process.
  • It increases agility by allowing developers to quickly make code changes and deploy them to production.

Top comments (0)