Add github workflow deploy action #2
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 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 }} |