Skip to content

Merge pull request #895 from hngprojects/dev #4

Merge pull request #895 from hngprojects/dev

Merge pull request #895 from hngprojects/dev #4

name: Staging Deployment
on:
workflow_dispatch:
push:
branches:
- staging
paths-ignore:
- .github/workflows/**
jobs:
build_and_push:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
file: docker/staging/Dockerfile
push: true
tags: hngdevops/nextjs-boilerplate:staging
deploy_to_staging:
needs: build_and_push
if: github.event.repository.fork == false
runs-on: ubuntu-latest
environment:
name: "staging"
url: ${{ vars.URL }}
steps:
- name: Deploy to staging environment
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
script: |
cd hng_boilerplate_nextjs
./scripts/staging_deploy.sh