82 lines
2.0 KiB
YAML
82 lines
2.0 KiB
YAML
name: MindSift Multi-Arch Docker Build
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
tags:
|
|
- 'v*'
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
test:
|
|
name: Lint, Build & Unit Tests
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout Code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.23'
|
|
|
|
- name: Run Backend Tests
|
|
run: |
|
|
go mod tidy
|
|
go vet ./...
|
|
go test -v ./...
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '22'
|
|
|
|
- name: Build & Verify Frontend
|
|
run: |
|
|
cd frontend
|
|
npm install --no-audit --no-fund
|
|
npm run build
|
|
|
|
build-docker:
|
|
name: Build & Push Docker Image
|
|
needs: test
|
|
runs-on: ubuntu-latest
|
|
if: github.event_name == 'push'
|
|
steps:
|
|
- name: Checkout Code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Prepare Registry Hostname
|
|
id: prep
|
|
run: |
|
|
REGISTRY_HOST=$(echo "${{ gitea.server_url }}" | sed -E 's#^https?://##' | sed 's#/$##')
|
|
IMAGE_NAME=$(echo "${REGISTRY_HOST}/${{ gitea.repository }}" | tr '[:upper:]' '[:lower:]')
|
|
echo "registry=${REGISTRY_HOST}" >> $GITHUB_OUTPUT
|
|
echo "image=${IMAGE_NAME}" >> $GITHUB_OUTPUT
|
|
|
|
- name: Set up QEMU (Multi-Arch)
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Login to Gitea Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ steps.prep.outputs.registry }}
|
|
username: ${{ gitea.actor }}
|
|
password: ${{ secrets.GITEA_TOKEN }}
|
|
|
|
- name: Build and Push
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
platforms: linux/amd64,linux/arm64
|
|
push: true
|
|
tags: |
|
|
${{ steps.prep.outputs.image }}:latest
|
|
${{ steps.prep.outputs.image }}:${{ gitea.sha }}
|