Skip to main content

GitHub Actions Integration

Automate your Nife deployments using GitHub Actions. Trigger deployments on every push, pull request merge, or release.

Prerequisites

  • A Nife account with an active application
  • A NIFE_ACCESS_TOKEN stored as a GitHub secret
  • nifectl CLI knowledge

Quick Setup

Add this workflow to .github/workflows/deploy.yml in your repository:

name: Deploy to Nife

on:
push:
branches: [main]

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Install nifectl
run: |
curl -L https://github.com/nifetency/nife-release/releases/latest/download/nifectl_linux_amd64 -o nifectl
chmod +x nifectl
sudo mv nifectl /usr/local/bin/

- name: Deploy to Nife
env:
NIFE_ACCESS_TOKEN: ${{ secrets.NIFE_ACCESS_TOKEN }}
run: |
nifectl auth login --token $NIFE_ACCESS_TOKEN
nifectl deploy

Setting Up the Secret

  1. Go to your GitHub repository → SettingsSecrets and variablesActions
  2. Click New repository secret
  3. Name: NIFE_ACCESS_TOKEN
  4. Value: Your Nife access token (from Access Tokens)
  5. Click Add secret

Advanced: Build and Deploy

name: Build and Deploy

on:
push:
branches: [main]

jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Build Docker image
run: docker build -t myapp:${{ github.sha }} .

- name: Push to registry
run: |
docker tag myapp:${{ github.sha }} registry.hub.docker.com/myorg/myapp:latest
docker push registry.hub.docker.com/myorg/myapp:latest

- name: Deploy to Nife
env:
NIFE_ACCESS_TOKEN: ${{ secrets.NIFE_ACCESS_TOKEN }}
run: |
nifectl auth login --token $NIFE_ACCESS_TOKEN
nifectl deploy --image registry.hub.docker.com/myorg/myapp:latest