feat: build frontend via cicd
Some checks failed
Build and Deploy Go App / build (push) Failing after 6m34s
Build and Deploy Go App / deploy (push) Has been skipped

This commit is contained in:
nihonium 2025-10-09 15:16:48 +03:00
parent f680e16be5
commit 951db38e4c
Signed by: nihonium
GPG key ID: 0251623741027CFC

View file

@ -9,34 +9,55 @@ on:
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
env:
BACKEND_API_BASE_URL: ${{ vars.BACKEND_API_BASE_URL }}
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
# Build backend
- uses: actions/setup-go@v6 - uses: actions/setup-go@v6
with: with:
go-version: '^1.25' go-version: '^1.25'
check-latest: false check-latest: false
cache-dependency-path: | cache-dependency-path: |
modules/server/go.sum modules/backend/go.sum
- name: Build Go app
run: |
cd modules/backend
go build -o nyanimedb .
tar -czvf nyanimedb-backend.tar.gz nyanimedb templates/
- name: Upload built backend to artifactory
uses: actions/upload-artifact@v3
with:
name: nyanimedb-backend.tar.gz
path: modules/backend/nyanimedb-backend.tar.gz
# Build frontend
- uses: actions/setup-node@v5
with:
node-version-file: 'modules/frontend/package.json'
cache: 'npm'
cache-dependency-path: modules/frontend/package-lock.json
- name: Build frontend
run: |
cd modules/frontend
npm run build
tar -czvf nyanimedb-frontend.tar.gz dist/
- name: Upload built frontend to artifactory
uses: actions/upload-artifact@v3
with:
name: nyanimedb-frontend.tar.gz
path: modules/frontend/nyanimedb-frontend.tar.gz
# Build Docker images
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
# Build application
- name: Build Go app
run: |
cd modules/server
go mod tidy
go build -o nyanimedb .
- name: Upload built application to artifactory
uses: actions/upload-artifact@v3
with:
name: nyanimedb
path: modules/server/nyanimedb
# Build Docker image
- name: Login to Docker Hub - name: Login to Docker Hub
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
@ -44,13 +65,21 @@ jobs:
username: ${{ secrets.REGISTRY_USERNAME }} username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_TOKEN }} password: ${{ secrets.REGISTRY_TOKEN }}
- name: Build and push - name: Build and push backend image
uses: docker/build-push-action@v6 uses: docker/build-push-action@v6
with: with:
context: ./modules/server file: Dockerfiles/Dockerfile_backend
file: Dockerfiles/Dockerfile_server
push: true push: true
tags: meowgit.nekoea.red/nihonium/nyanimedb:latest tags: meowgit.nekoea.red/nihonium/nyanimedb-backend:latest
- name: Build and push frontend image
uses: docker/build-push-action@v6
with:
build-args:
--build-arg VITE_BACKEND_API_BASE_URL=${BACKEND_API_BASE_URL}
file: Dockerfiles/Dockerfile_frontend
push: true
tags: meowgit.nekoea.red/nihonium/nyanimedb-frontend:latest
deploy: deploy:
runs-on: self-hosted runs-on: self-hosted