Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ACC-181): split deployment workflows #164

Merged
merged 2 commits into from
Jul 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/workflows/saas-deploy-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: NMUI SaaS Deployment to Dev

on:
push:
branches:
- develop

jobs:
build-deploy:
runs-on: ubuntu-latest
steps:
- name: "Checkout to develop"
uses: actions/checkout@v3
with:
ref: develop

- name: Set release tag
run: |
TAG="$(git rev-parse --short HEAD)"
echo "TAG=${TAG}" >> $GITHUB_ENV

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile.saas
platforms: linux/amd64
push: true
tags: ${{ github.repository_owner }}/netmaker-ui-saas:${{ env.TAG }}

- name: Set up kubectl
uses: matootie/[email protected]
with:
personalAccessToken: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
clusterName: saas-dev-cluster-europe-1

- name: Set k8s deployment image
run: kubectl set image deployment netmaker-ui netmaker-ui=${{ github.repository_owner }}/netmaker-ui-saas:${{ env.TAG }} -n accounts

- name: Deploy to k8s cluster
run: kubectl rollout restart deploy netmaker-ui -n accounts

- name: Verify deployment
run: kubectl rollout status deployment/netmaker-ui -n accounts

54 changes: 54 additions & 0 deletions .github/workflows/saas-deploy-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: NMUI SaaS Deployment to Prod

on:
push:
branches:
- saas-prod

jobs:
build-deploy:
runs-on: ubuntu-latest
steps:
- name: "Checkout to saas-prod"
uses: actions/checkout@v3
with:
ref: saas-prod

- name: Set release tag
run: |
TAG="$(git rev-parse --short HEAD)"
echo "TAG=${TAG}" >> $GITHUB_ENV

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile.saas
platforms: linux/amd64
push: true
tags: ${{ github.repository_owner }}/netmaker-ui-saas:${{ env.TAG }}

- name: Set up kubectl
uses: matootie/[email protected]
with:
personalAccessToken: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
clusterName: saas-prod-cluster-us-west

- name: Set k8s deployment image
run: kubectl set image deployment netmaker-ui netmaker-ui=${{ github.repository_owner }}/netmaker-ui-saas:${{ env.TAG }} -n accounts

- name: Deploy to k8s cluster
run: kubectl rollout restart deploy netmaker-ui -n accounts

- name: Verify deployment
run: kubectl rollout status deployment/netmaker-ui -n accounts

53 changes: 53 additions & 0 deletions .github/workflows/saas-deploy-staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: NMUI SaaS Deployment to Staging

on:
push:
branches:
- staging

jobs:
build-deploy:
runs-on: ubuntu-latest
steps:
- name: "Checkout to staging"
uses: actions/checkout@v3
with:
ref: staging

- name: Set release tag
run: |
TAG="$(git rev-parse --short HEAD)"
echo "TAG=${TAG}" >> $GITHUB_ENV

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile.saas
platforms: linux/amd64
push: true
tags: ${{ github.repository_owner }}/netmaker-ui-saas:${{ env.TAG }}

- name: Set up kubectl
uses: matootie/[email protected]
with:
personalAccessToken: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
clusterName: saas-staging-cluster-us-west

- name: Set k8s deployment image
run: kubectl set image deployment netmaker-ui netmaker-ui=${{ github.repository_owner }}/netmaker-ui-saas:${{ env.TAG }} -n accounts

- name: Deploy to k8s cluster
run: kubectl rollout restart deploy netmaker-ui -n accounts

- name: Verify deployment
run: kubectl rollout status deployment/netmaker-ui -n accounts
Loading