Merge pull request #49 from KNPhilip/deployment #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy Web Application | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
paths: | |
- 'frontend/web-app/**' | |
env: | |
REGISTRY_IMAGE: knphilip/bidwheels-web-app | |
DOCKERFILE: frontend/web-app/Dockerfile | |
DEPLOYMENT_NAME: webapp | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Build and push the Docker image | |
uses: knphilip/actions/dockerfile-push@main | |
with: | |
context: "{{defaultContext}}" | |
tags: ${{ env.REGISTRY_IMAGE }}:latest | |
file: ${{ env.DOCKERFILE }} | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Install doctl | |
uses: digitalocean/action-doctl@v2 | |
with: | |
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }} | |
- name: Save DigitalOcean kubeconfig | |
run: doctl kubernetes cluster kubeconfig save bidwheels | |
- name: Restart Kubernetes deployment | |
run: kubectl rollout restart deployment ${{ secrets.DEPLOYMENT_NAME }} |