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_TOKENstored as a GitHub secret nifectlCLI 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
- Go to your GitHub repository → Settings → Secrets and variables → Actions
- Click New repository secret
- Name:
NIFE_ACCESS_TOKEN - Value: Your Nife access token (from Access Tokens)
- 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