diff --git a/.github/workflows/saas-deploy-dev.yml b/.github/workflows/saas-deploy-dev.yml new file mode 100644 index 00000000..2e0a6e03 --- /dev/null +++ b/.github/workflows/saas-deploy-dev.yml @@ -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/dokube@v1.4.0 + 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 + \ No newline at end of file diff --git a/.github/workflows/saas-deploy-prod.yml b/.github/workflows/saas-deploy-prod.yml new file mode 100644 index 00000000..b6da3115 --- /dev/null +++ b/.github/workflows/saas-deploy-prod.yml @@ -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/dokube@v1.4.0 + 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 + \ No newline at end of file diff --git a/.github/workflows/saas-deploy-staging.yml b/.github/workflows/saas-deploy-staging.yml new file mode 100644 index 00000000..4f6e95e5 --- /dev/null +++ b/.github/workflows/saas-deploy-staging.yml @@ -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/dokube@v1.4.0 + 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