From 87cb51762305c3a920a9ef97cb421e04817d64c8 Mon Sep 17 00:00:00 2001 From: Joshua King Date: Wed, 20 May 2026 08:04:50 -0400 Subject: [PATCH 1/4] Update CI workflow to match Go+React stack with Docker registry push --- .gitea/workflows/dev.yml | 74 +++++++++++++++++++++++++++++++++------- 1 file changed, 61 insertions(+), 13 deletions(-) diff --git a/.gitea/workflows/dev.yml b/.gitea/workflows/dev.yml index 393cce2..1a6c9aa 100644 --- a/.gitea/workflows/dev.yml +++ b/.gitea/workflows/dev.yml @@ -1,4 +1,4 @@ -name: Dev Build +name: Dev Build & Deploy on: pull_request: @@ -6,40 +6,88 @@ on: push: branches: [dev] +env: + REGISTRY: code.cubecraftcreations.com + BACKEND_IMAGE: ${{ gitea.repository }}/backend + FRONTEND_IMAGE: ${{ gitea.repository }}/frontend + jobs: - build-test: - runs-on: ubuntu-dotnet + test-and-build: + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Restore backend - run: dotnet restore + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: "1.23" + + - name: Run backend tests + run: go test ./... + working-directory: ./go-backend - name: Build backend - run: dotnet build --no-restore --configuration Release - - - name: Test backend - run: dotnet test --no-build --configuration Release + run: go build -ldflags="-w -s" -o /tmp/server ./cmd/server + working-directory: ./go-backend - name: Setup Node uses: actions/setup-node@v4 with: - node-version: "24" + node-version: "22" - name: Install frontend deps run: npm ci working-directory: ./frontend + - name: Lint frontend + run: npm run lint + working-directory: ./frontend + - name: Build frontend run: npm run build working-directory: ./frontend - deploy-dev: - needs: build-test + docker-build-push: + needs: test-and-build if: gitea.event_name == 'push' runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Login to Gitea Container Registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ gitea.actor }} + password: ${{ secrets.GITEA_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build & push backend image + uses: docker/build-push-action@v6 + with: + context: ./go-backend + push: true + tags: | + ${{ env.REGISTRY }}/${{ env.BACKEND_IMAGE }}:dev + ${{ env.REGISTRY }}/${{ env.BACKEND_IMAGE }}:${{ gitea.sha }} + + - name: Build & push frontend image + uses: docker/build-push-action@v6 + with: + context: ./frontend + push: true + tags: | + ${{ env.REGISTRY }}/${{ env.FRONTEND_IMAGE }}:dev + ${{ env.REGISTRY }}/${{ env.FRONTEND_IMAGE }}:${{ gitea.sha }} + + deploy-dev: + needs: docker-build-push + runs-on: ubuntu-latest + steps: - name: Deploy dev run: | @@ -47,4 +95,4 @@ jobs: chmod 600 /tmp/dev_key ssh -i /tmp/dev_key -o StrictHostKeyChecking=no \ ${{ secrets.DEV_DEPLOY_USER }}@${{ secrets.DEV_DEPLOY_HOST }} \ - "${{ secrets.DEV_DEPLOY_PATH }}/deploy.sh" \ No newline at end of file + "${{ secrets.DEV_DEPLOY_PATH }}/deploy.sh" From 0e452941dd97c54215866ee817935d2fc2def29e Mon Sep 17 00:00:00 2001 From: Joshua King Date: Wed, 20 May 2026 08:06:52 -0400 Subject: [PATCH 2/4] Remove deploy-dev job - deployment handled via docker-compose --- .gitea/workflows/dev.yml | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/.gitea/workflows/dev.yml b/.gitea/workflows/dev.yml index 1a6c9aa..a886156 100644 --- a/.gitea/workflows/dev.yml +++ b/.gitea/workflows/dev.yml @@ -83,16 +83,3 @@ jobs: tags: | ${{ env.REGISTRY }}/${{ env.FRONTEND_IMAGE }}:dev ${{ env.REGISTRY }}/${{ env.FRONTEND_IMAGE }}:${{ gitea.sha }} - - deploy-dev: - needs: docker-build-push - runs-on: ubuntu-latest - - steps: - - name: Deploy dev - run: | - echo "${{ secrets.DEV_DEPLOY_SSH_KEY }}" > /tmp/dev_key - chmod 600 /tmp/dev_key - ssh -i /tmp/dev_key -o StrictHostKeyChecking=no \ - ${{ secrets.DEV_DEPLOY_USER }}@${{ secrets.DEV_DEPLOY_HOST }} \ - "${{ secrets.DEV_DEPLOY_PATH }}/deploy.sh" From 5f42a3be182bcf5f50b6065e4dd3f677e6287694 Mon Sep 17 00:00:00 2001 From: Joshua King Date: Wed, 20 May 2026 08:08:21 -0400 Subject: [PATCH 3/4] Rename GITEA_TOKEN secret to ACCESS_TOKEN --- .gitea/workflows/dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/dev.yml b/.gitea/workflows/dev.yml index a886156..6df613f 100644 --- a/.gitea/workflows/dev.yml +++ b/.gitea/workflows/dev.yml @@ -61,7 +61,7 @@ jobs: with: registry: ${{ env.REGISTRY }} username: ${{ gitea.actor }} - password: ${{ secrets.GITEA_TOKEN }} + password: ${{ secrets.ACCESS_TOKEN }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 From ee6ad10db98965886fe7ab532e2c1bdd08ea05b3 Mon Sep 17 00:00:00 2001 From: Joshua King Date: Wed, 20 May 2026 08:10:13 -0400 Subject: [PATCH 4/4] Replace setup-go/setup-node actions with manual install for Gitea runner compatibility --- .gitea/workflows/dev.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.gitea/workflows/dev.yml b/.gitea/workflows/dev.yml index 6df613f..248555c 100644 --- a/.gitea/workflows/dev.yml +++ b/.gitea/workflows/dev.yml @@ -19,9 +19,9 @@ jobs: - uses: actions/checkout@v4 - name: Setup Go - uses: actions/setup-go@v5 - with: - go-version: "1.23" + run: | + curl -sL https://go.dev/dl/go1.23.6.linux-amd64.tar.gz | tar -C /usr/local -xz + echo "/usr/local/go/bin" >> $GITHUB_PATH - name: Run backend tests run: go test ./... @@ -32,9 +32,9 @@ jobs: working-directory: ./go-backend - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: "22" + run: | + curl -sL https://deb.nodesource.com/setup_22.x | bash - + apt-get install -y nodejs - name: Install frontend deps run: npm ci