Skip to content

Commit

Permalink
Add github workflow deploy action
Browse files Browse the repository at this point in the history
  • Loading branch information
zuhdil committed Jan 24, 2025
1 parent 0e816d5 commit 997c8be
Showing 1 changed file with 122 additions and 0 deletions.
122 changes: 122 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
name: Deploy to Test Cluster

on:
push:
branches:
- main

jobs:
build-push:
name: Build and Push to Registry
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: src

- name: Checkout Akvo composite actions
uses: actions/checkout@v4
with:
repository: akvo/composite-actions
token: ${{ secrets.GH_PAT }}
path: composite-actions
ref: 0.0.7

- name: Docker Build Nginx
uses: ./composite-actions/.github/actions/docker-build
with:
app-name: "climate-think-and-do-tank"
service-name: "nginx"
dockerfile-location: "nginx"
cluster-name: "test"

- name: Docker Build Frontend
uses: ./composite-actions/.github/actions/docker-build
with:
app-name: "climate-think-and-do-tank"
service-name: "frontend"
dockerfile-location: "frontend"
cluster-name: "test"

- name: Docker Build Backend
uses: ./composite-actions/.github/actions/docker-build
with:
app-name: "climate-think-and-do-tank"
service-name: "backend"
dockerfile-location: "backend"
cluster-name: "test"

- name: Docker Push Nginx
uses: ./composite-actions/.github/actions/docker-push
with:
app-name: "climate-think-and-do-tank"
service-name: "nginx"
gcloud-sa: ${{ secrets.GCLOUD_SERVICE_ACCOUNT_REGISTRY }}
cluster-name: "test"

- name: Docker Push Frontend
uses: ./composite-actions/.github/actions/docker-push
with:
app-name: "climate-think-and-do-tank"
service-name: "frontend"
gcloud-sa: ${{ secrets.GCLOUD_SERVICE_ACCOUNT_REGISTRY }}
cluster-name: "test"

- name: Docker Push Backend
uses: ./composite-actions/.github/actions/docker-push
with:
app-name: "climate-think-and-do-tank"
service-name: "backend"
gcloud-sa: ${{ secrets.GCLOUD_SERVICE_ACCOUNT_REGISTRY }}
cluster-name: "test"


rollout:
name: Rollout to the server
needs: build-push
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: src

- name: Checkout Akvo composite actions
uses: actions/checkout@v4
with:
repository: akvo/composite-actions
token: ${{ secrets.GH_PAT }}
path: composite-actions
ref: 0.0.7

- name: Rollout Nginx
uses: ./composite-actions/.github/actions/k8s-rollout
with:
app-name: "climate-think-and-do-tank"
deployment-name: "nginx-deployment"
container-name: "nginx"
cluster-name: "test"
namespace-name: "climate-think-and-do-tank-namespace"
gcloud-sa: ${{ secrets.GCLOUD_SERVICE_ACCOUNT_K8S }}


- name: Rollout Frontend
uses: ./composite-actions/.github/actions/k8s-rollout
with:
app-name: "climate-think-and-do-tank"
deployment-name: "frontend-deployment"
container-name: "frontend"
cluster-name: "test"
namespace-name: "climate-think-and-do-tank-namespace"
gcloud-sa: ${{ secrets.GCLOUD_SERVICE_ACCOUNT_K8S }}

- name: Rollout Backend
uses: ./composite-actions/.github/actions/k8s-rollout
with:
app-name: "climate-think-and-do-tank"
deployment-name: "backend-deployment"
container-name: "backend"
cluster-name: "test"
namespace-name: "climate-think-and-do-tank-namespace"
gcloud-sa: ${{ secrets.GCLOUD_SERVICE_ACCOUNT_K8S }}

0 comments on commit 997c8be

Please # to comment.