Skip to main content

Deploy Static Sites with GitHub Actions on Nife | Site CI/CD Integration

Learn to deploy static sites using GitHub Actions with Nife. Automatically deploy your site on every push to GitHub with just 3 simple steps.


Overview

Setting up automated deployments for your static site on Nife takes just 3 steps:

  1. Deploy Your Site - Get your site live on Nife
  2. Setup GitHub CI/CD - Configure automatic deployments
  3. Verify & Monitor - Confirm everything is working

Let's get started!


Step 1: Deploy Your Site

Before setting up GitHub CI/CD automation, your site needs to be deployed to Nife for the first time.

Option A: Deploy Using Nife Dashboard

  1. Head to launch.nife.io and create an account (or log in).
  2. From the left navigation menu, go to Applications.
  3. Open the Sites tab.
  4. Click New Site.
  5. Provide your GitHub repository URL and select the branch you want to deploy.
  6. Configure your deployment settings, such as the framework, build requirements, install command, build command, and build output directory.
  7. If your repository is private, provide the required authentication details.
  8. Click Deploy Site

Your site is now live on Nife!

Option B: Deploy Using nifectl CLI

Run the deployment command:

nifectl site deploy

When prompted, provide:

  • Site name - Name your static site
  • Source code - Your GitHub repository URL (e.g., https://github.com/username/my-site)
  • Build directory - Where your built files are (e.g., dist/, build/, public/)

The CLI will automatically create your nife.toml configuration file and deploy your site.

What Happens Next

After deployment:

  • ✅ Your site is live with a Nife URL
  • ✅ A nife.toml configuration file is created
  • ✅ You're ready to set up GitHub CI/CD

Step 2: Setup GitHub CI/CD

Now that your site is deployed, configure automatic deployments on every GitHub push using Nife Dashboard's guided setup.

Access CI/CD Setup in Nife Dashboard

  1. Log in to launch.nife.io
  2. Go to your Site
  3. Look for Setup GitHub CI/CD button
  4. Click it to open the guided setup
Setup GitHub CI/CD

Follow the 3 Steps in Dashboard

The Nife Dashboard will guide you through 3 simple steps:

Step 1: Configure Workflow

  • Download the GitHub Actions workflow template from the dashboard
  • Or copy this workflow to your repository as .github/workflows/deploy-site.yml:
name: Deploy Site to Nife
on:
push:
branches:
- main
- master
jobs:
deploy:
name: Deploy to Nife
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Deploy Site to Nife
uses: nifetency/nife-[email protected]
env:
NIFE_ACCESS_TOKEN: ${{ secrets.NIFE_ACCESS_TOKEN }}
with:
args: "site redeploy --yes"

This workflow automatically deploys your site on every push to main or master branches.

Step 2: Download nife.toml

nife.toml configuration

Before downloading, add your GitHub repository URL:

  1. In the dashboard, locate the Git URL input field
  2. Enter your GitHub repository URL:
    https://github.com/your-org/your-repo
  3. The dashboard will auto-populate the nife.toml configuration with your git URL
  4. Click Download nife.toml
  5. Save the file to your repository root
  6. Commit and push to GitHub:
git add nife.toml
git commit -m "Add Nife site configuration with GitHub URL"
git push

The nife.toml file now contains your site configuration with the git URL automatically set for deployments.

Step 3: Add Nife Access Token

Nife Access Token
  • Generate an API token from the dashboard
  • Add it as a GitHub Secret named NIFE_ACCESS_TOKEN
  • The dashboard provides step-by-step instructions

Commit Everything to GitHub

Once you've completed all 3 steps, commit your changes:

git add .github/workflows/deploy-site.yml nife.toml
git commit -m "Setup Nife GitHub Actions CI/CD"
git push

GitHub Actions is now configured and ready to deploy automatically!


Step 3: Verify & Monitor

Test your setup and confirm everything works.

Trigger Your First Deployment

Make a test commit to trigger the workflow:

# Make a small change
echo "# Site updated" >> README.md

# Commit and push
git add README.md
git commit -m "test: verify GitHub Actions deployment"
git push

Monitor the Deployment

  1. Go to your GitHub repository
  2. Click Actions tab
  3. Watch your workflow run in real-time
  4. See deployment status and logs

Workflow should show:

  • ✅ Checkout code - Success
  • ✅ Deploy Site to Nife - Success
  • 🟢 Workflow complete

Verify Site Updated

  1. Go to launch.nife.io
  2. Click on your Site
  3. View the live URL
  4. Check that your changes are live

Congratulations! Your site now deploys automatically on every push! 🎉


How It Works

Here's what happens when you push code:

1. You push to GitHub (main/master branch)

2. GitHub Actions workflow triggers automatically

3. Checkout your repository code

4. Execute "site redeploy --yes" command

5. Nife reads nife.toml configuration

6. Pulls latest code from GitHub

7. Runs build command (npm run build, etc.)

8. Deploys built files to Nife

9. Site is live with your changes (seconds later)

Supported Frameworks

Works with any framework that produces static files:

  • React - npm run build
  • Vue - npm run build
  • Next.js - npm run build
  • Astro - npm run build
  • Jekyll - jekyll build
  • Hugo - hugo
  • Gatsby - gatsby build
  • Eleventy - eleventy
  • Svelte - npm run build
  • Static HTML - No build needed

Troubleshooting

Workflow doesn't trigger

  • Verify .github/workflows/deploy-site.yml exists
  • Check file is committed and pushed to GitHub
  • Ensure workflow is on correct branch (main or master)

"NIFE_ACCESS_TOKEN not found" error

  • Go to GitHub Settings → Secrets and verify token exists
  • If missing, add it again from Nife Dashboard
  • Make sure secret name is exactly NIFE_ACCESS_TOKEN

"Site not found" error

  • Verify site exists in Nife Dashboard
  • Check nife.toml is in repository root
  • Ensure site name in nife.toml matches Nife Dashboard
  • Verify git-url points to correct GitHub repository

Site doesn't update after push

  • Check GitHub Actions logs for errors
  • Verify git-url and git-branch in nife.toml are correct
  • Ensure build command works locally: npm run build
  • Check that output directory matches output field in nife.toml

Deployment timeout

  • Check if site is very large
  • Review GitHub Actions logs for details
  • Increase timeout in workflow: timeout-minutes: 15

Best Practices

Keep nife.toml in Git - Version control your deployment configuration
Use meaningful commits - Track what changed in each deployment
Test locally first - Run build command before pushing
Protect main branch - Require reviews before merging
Monitor deployments - Check Actions tab after pushing
Regenerate tokens - Update tokens every 30-60 days
Use specific build commands - Ensure correct output
Verify output directory - Match output field in nife.toml


Environment Variables

If your build needs environment variables:

  1. Go to GitHub repository Settings
  2. Secrets and variables → Actions
  3. Add variables like REACT_APP_API_URL
  4. Reference in your code normally
  5. GitHub Actions automatically includes them in deployments

Next Steps

Your static site is now set up for automated deployments! What's next?

  1. Deploy more frequently - Push updates without manual steps
  2. Add environment variables - Store secrets securely
  3. Scale to multiple sites - Deploy multiple sites with Nife
  4. Monitor performance - Use Nife dashboard to track metrics
  5. Set up alerts - Get notified of deployment issues

More Resources


© Nife - Deploy anything, anywhere