Skip to content

Commit

Permalink
ci: add server ci
Browse files Browse the repository at this point in the history
  • Loading branch information
toufiq-austcse committed Dec 13, 2024
1 parent aa4fa5b commit cf7d94b
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 11 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/server-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Build and publish deploybl server docker image
on:
push:
branches:
- master
paths:
- server/**
jobs:
setup-build-publish:
name: Setup, Build, and Publish Docker Image
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Login to docker hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: server build and push to registry
uses: docker/build-push-action@v3
with:
context: ./server/
file: ./server/Dockerfile
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/deploybl-server:latest
22 changes: 11 additions & 11 deletions server/internal/api/deployments/controller/deployment_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func NewDeploymentController(
// @Produce json
// @Success 200
// @Router /api/v1/deployments [get]
// @Success 200 {object} api_response.Response{data=[]res.DeploymentRes}
// @Success 200 {object} api_response.Response{data=[]res.DeploymentRes}
func (controller *DeploymentController) DeploymentIndex(context *gin.Context) {
user := utils.GetUserFromContext(context)

Expand Down Expand Up @@ -111,7 +111,7 @@ func (controller *DeploymentController) DeploymentIndex(context *gin.Context) {
// @Produce json
// @Success 201
// @Router /api/v1/deployments [post]
// @Success 201 {object} api_response.Response{data=res.DeploymentRes}
// @Success 201 {object} api_response.Response{data=res.DeploymentRes}
func (controller *DeploymentController) DeploymentCreate(context *gin.Context) {
user := utils.GetUserFromContext(context)
body := &req.CreateDeploymentReqDto{}
Expand Down Expand Up @@ -209,7 +209,7 @@ func (controller *DeploymentController) DeploymentCreate(context *gin.Context) {
// @Produce json
// @Success 200
// @Router /api/v1/deployments/{id} [patch]
// @Success 200 {object} api_response.Response{data=res.DeploymentDetailsRes}
// @Success 200 {object} api_response.Response{data=res.DeploymentDetailsRes}
func (controller *DeploymentController) DeploymentUpdate(context *gin.Context) {
deploymentId := context.Param("id")
user := utils.GetUserFromContext(context)
Expand Down Expand Up @@ -327,7 +327,7 @@ func (controller *DeploymentController) DeploymentUpdate(context *gin.Context) {
// @Produce json
// @Success 200
// @Router /api/v1/deployments/{id}/env [put]
// @Success 200 {object} api_response.Response{data=res.DeploymentDetailsRes}
// @Success 200 {object} api_response.Response{data=res.DeploymentDetailsRes}
func (controller *DeploymentController) EnvUpdate(context *gin.Context) {
var envBody map[string]string
if err := context.BindJSON(&envBody); err != nil {
Expand Down Expand Up @@ -444,7 +444,7 @@ func (controller *DeploymentController) EnvUpdate(context *gin.Context) {
// @Produce json
// @Success 200
// @Router /api/v1/deployments/{id} [get]
// @Success 200 {object} api_response.Response{data=res.DeploymentDetailsRes}
// @Success 200 {object} api_response.Response{data=res.DeploymentDetailsRes}
func (controller *DeploymentController) DeploymentShow(context *gin.Context) {
deploymentId := context.Param("id")
user := utils.GetUserFromContext(context)
Expand Down Expand Up @@ -480,7 +480,7 @@ func (controller *DeploymentController) DeploymentShow(context *gin.Context) {
// @Produce json
// @Success 200
// @Router /api/v1/deployments/{id}/restart [post]
// @Success 200 {object} api_response.Response{data=res.DeploymentDetailsRes}
// @Success 200 {object} api_response.Response{data=res.DeploymentDetailsRes}
func (controller *DeploymentController) DeploymentRestart(context *gin.Context) {
deploymentId := context.Param("id")
user := utils.GetUserFromContext(context)
Expand Down Expand Up @@ -565,7 +565,7 @@ func (controller *DeploymentController) DeploymentRestart(context *gin.Context)
// @Produce json
// @Success 200
// @Router /api/v1/deployments/{id}/rebuild-and-redeploy [post]
// @Success 200 {object} api_response.Response{data=res.DeploymentDetailsRes}
// @Success 200 {object} api_response.Response{data=res.DeploymentDetailsRes}
func (controller *DeploymentController) DeploymentRebuildAndReDeploy(context *gin.Context) {
deploymentId := context.Param("id")
user := utils.GetUserFromContext(context)
Expand Down Expand Up @@ -643,7 +643,7 @@ func (controller *DeploymentController) DeploymentRebuildAndReDeploy(context *gi
// @Produce json
// @Success 200
// @Router /api/v1/deployments/{id}/stop [post]
// @Success 200 {object} api_response.Response{data=res.DeploymentDetailsRes}
// @Success 200 {object} api_response.Response{data=res.DeploymentDetailsRes}
func (controller *DeploymentController) DeploymentStop(context *gin.Context) {
deploymentId := context.Param("id")
user := utils.GetUserFromContext(context)
Expand Down Expand Up @@ -733,7 +733,7 @@ func (controller *DeploymentController) DeploymentStop(context *gin.Context) {
// @Produce json
// @Success 200
// @Router /api/v1/deployments/latest-status [get]
// @Success 200 {object} api_response.Response{data=[]res.DeploymentLatestStatusRes}
// @Success 200 {object} api_response.Response{data=[]res.DeploymentLatestStatusRes}
func (controller *DeploymentController) DeploymentLatestStatus(context *gin.Context) {
idsQuery, ok := context.GetQuery("ids")
user := utils.GetUserFromContext(context)
Expand Down Expand Up @@ -791,7 +791,7 @@ func (controller *DeploymentController) DeploymentLatestStatus(context *gin.Cont
// @Produce json
// @Success 200
// @Router /api/v1/deployments/check-stopped-cron [post]
// @Success 200 {object} api_response.Response{data=int}
// @Success 200 {object} api_response.Response{data=int}
func (controller *DeploymentController) LiveCheckCron(context *gin.Context) {
runningContainerIds, err := controller.dockerService.ListRunningContainerIds()
if err != nil {
Expand Down Expand Up @@ -843,7 +843,7 @@ func (controller *DeploymentController) LiveCheckCron(context *gin.Context) {
// @Produce json
// @Success 200
// @Router /api/v1/deployments/check-deploying-cron [post]
// @Success 200 {object} api_response.Response{data=int}
// @Success 200 {object} api_response.Response{data=int}
func (controller *DeploymentController) DeployingCheckCron(context *gin.Context) {
count := 0

Expand Down

0 comments on commit cf7d94b

Please sign in to comment.