Skip to content

Merge pull request #738 from hngprojects/staging #1

Merge pull request #738 from hngprojects/staging

Merge pull request #738 from hngprojects/staging #1

name: Production Deployment
on:
workflow_dispatch:
push:
branches:
- main
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/prod/Dockerfile
push: true
tags: hngdevops/nextjs-boilerplate:prod
deploy_to_production:
needs: build_and_push
if: github.event.repository.fork == false
runs-on: ubuntu-latest
environment:
name: "production"
url: ${{ vars.URL }}
steps:
- name: Deploy to production environment
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
script: |
cd hng_boilerplate_nextjs
./scripts/prod_deploy.sh