10 Commits

Author SHA1 Message Date
Fran Jurmanović
56c51e5d02 fix env not passing
All checks were successful
Release and Deploy / build (push) Successful in 1m57s
Release and Deploy / deploy (push) Successful in 22s
2025-07-31 18:24:12 +02:00
Fran Jurmanović
1c57da9aba update release.yml health
Some checks failed
Release and Deploy / build (push) Successful in 1m58s
Release and Deploy / deploy (push) Failing after 1m19s
2025-07-31 18:17:41 +02:00
Fran Jurmanović
b2d88f1aa3 update version 2025-07-31 18:14:43 +02:00
Fran Jurmanović
45d9681203 fix system controller not initialized
Some checks failed
Release and Deploy / build (push) Successful in 1m58s
Release and Deploy / deploy (push) Failing after 1m19s
2025-07-31 18:13:43 +02:00
Fran Jurmanović
e259f2235a update deploy path cd
Some checks failed
Release and Deploy / build (push) Successful in 1m57s
Release and Deploy / deploy (push) Failing after 26s
2025-07-31 18:01:09 +02:00
Fran Jurmanović
e575f641c5 update migration script
Some checks failed
Release and Deploy / build (push) Successful in 1m59s
Release and Deploy / deploy (push) Failing after 15s
2025-07-31 17:56:11 +02:00
Fran Jurmanović
bb75a8c325 update release.yml
Some checks failed
Release and Deploy / build (push) Successful in 5m4s
Release and Deploy / deploy (push) Has been cancelled
2025-07-31 17:46:45 +02:00
Fran Jurmanović
99b1a2d1e9 CGO_ENABLED
Some checks failed
Release and Deploy / build (push) Failing after 1m34s
Release and Deploy / deploy (push) Has been skipped
2025-07-31 17:33:17 +02:00
Fran Jurmanović
a34b08072e update runner
Some checks failed
Release and Deploy / build (push) Failing after 6m38s
Release and Deploy / deploy (push) Has been skipped
2025-07-30 02:03:28 +02:00
Fran Jurmanović
8057420f09 Merge branch 'feature/add-delete-servers' 2025-07-30 01:59:31 +02:00
4 changed files with 21 additions and 60 deletions

View File

@@ -8,13 +8,13 @@ env:
GO_VERSION: "1.21" GO_VERSION: "1.21"
BINARY_NAME: "acc-server-manager" BINARY_NAME: "acc-server-manager"
MIGRATE_BINARY: "acc-server-migration" MIGRATE_BINARY: "acc-server-migration"
API_BINARY: "api"
DEPLOY_PATH: 'C:\acc-server-manager' DEPLOY_PATH: 'C:\acc-server-manager'
SERVICE_NAME: "ACC Server Manager" SERVICE_NAME: "ACC Server Manager"
HEALTH_URL: "http://localhost:4000/v1/system/health"
jobs: jobs:
build: build:
runs-on: windows-latest runs-on: windows
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v3 uses: actions/checkout@v3
@@ -27,35 +27,17 @@ jobs:
go-version: ${{ env.GO_VERSION }} go-version: ${{ env.GO_VERSION }}
- name: Run tests - name: Run tests
env:
CGO_ENABLED: 1
run: go test -v ./... run: go test -v ./...
- name: Build binaries - name: Build binaries
env:
CGO_ENABLED: 1
run: | run: |
mkdir -p build mkdir -p build
go build -v -o ./build/${{ env.BINARY_NAME }}.exe ./cmd/server go build -v -o ./build/${{ env.MIGRATE_BINARY }}.exe ./cmd/migrate
go build -v -o ./build/${{ env.MIGRATE_BINARY }}.exe ./cmd/migration go build -v -o ./build/${{ env.BINARY_NAME }}.exe ./cmd/api
go build -v -o ./build/${{ env.API_BINARY }}.exe ./cmd/api
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload release assets
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/
asset_name: acc-server-manager-${{ github.ref_name }}.zip
asset_content_type: application/zip
- name: Upload build artifacts - name: Upload build artifacts
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
@@ -66,7 +48,7 @@ jobs:
deploy: deploy:
needs: build needs: build
runs-on: windows-latest runs-on: windows
environment: production environment: production
steps: steps:
- name: Download build artifacts - name: Download build artifacts
@@ -113,7 +95,8 @@ jobs:
# Run database migrations # Run database migrations
Write-Host "Running database migrations..." Write-Host "Running database migrations..."
try { try {
& "${{ env.DEPLOY_PATH }}\${{ env.MIGRATE_BINARY }}.exe" & cd "${{ env.DEPLOY_PATH }}"
& ".\${{ env.MIGRATE_BINARY }}.exe"
} catch { } catch {
Write-Warning "Migration failed: $_" Write-Warning "Migration failed: $_"
throw "Migration failed" throw "Migration failed"
@@ -153,7 +136,7 @@ jobs:
while ($attempt -le $maxAttempts -and -not $success) { while ($attempt -le $maxAttempts -and -not $success) {
try { try {
$response = Invoke-WebRequest -Uri "http://localhost:8080/health" -TimeoutSec 5 $response = Invoke-WebRequest -Uri "${{ env.HEALTH_URL }}" -TimeoutSec 5
if ($response.StatusCode -eq 200) { if ($response.StatusCode -eq 200) {
Write-Host "Health check passed!" Write-Host "Health check passed!"
$success = $true $success = $true
@@ -168,31 +151,3 @@ jobs:
if (-not $success) { if (-not $success) {
throw "Health check failed after $maxAttempts attempts" throw "Health check failed after $maxAttempts attempts"
} }
- name: Notify on success
if: success()
uses: actions/github-script@v6
with:
script: |
const { repo, owner } = context.repo;
const release = context.ref.replace('refs/tags/', '');
await github.rest.issues.createComment({
owner,
repo,
issue_number: context.issue.number,
body: `✅ Successfully deployed ${release} to production!`
});
- name: Notify on failure
if: failure()
uses: actions/github-script@v6
with:
script: |
const { repo, owner } = context.repo;
const release = context.ref.replace('refs/tags/', '');
await github.rest.issues.createComment({
owner,
repo,
issue_number: context.issue.number,
body: `❌ Failed to deploy ${release} to production. Check the workflow logs for details.`
});

View File

@@ -20,7 +20,12 @@ func InitializeControllers(c *dig.Container) {
logging.Panic("unable to initialize auth middleware") logging.Panic("unable to initialize auth middleware")
} }
err := c.Invoke(NewServiceControlController) err := c.Invoke(NewSystemController)
if err != nil {
logging.Panic("unable to initialize system controller")
}
err = c.Invoke(NewServiceControlController)
if err != nil { if err != nil {
logging.Panic("unable to initialize service control controller") logging.Panic("unable to initialize service control controller")
} }

View File

@@ -2,6 +2,7 @@ package controller
import ( import (
"acc-server-manager/local/utl/common" "acc-server-manager/local/utl/common"
"acc-server-manager/local/utl/configs"
"github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2"
) )
@@ -34,5 +35,5 @@ func NewSystemController(routeGroups *common.RouteGroups) *SystemController {
// @Success 200 {array} string // @Success 200 {array} string
// @Router /v1/service-control [get] // @Router /v1/service-control [get]
func (ac *SystemController) getFirst(c *fiber.Ctx) error { func (ac *SystemController) getFirst(c *fiber.Ctx) error {
return c.SendStatus(fiber.StatusOK) return c.SendString(configs.Version)
} }

View File

@@ -8,7 +8,7 @@ import (
) )
var ( var (
Version = "0.0.1" Version = "0.10.2"
Prefix = "v1" Prefix = "v1"
Secret string Secret string
SecretCode string SecretCode string