ci: Add Gitea Actions workflow for testing and deployment
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
59
.gitea/workflows/ci.yaml
Normal file
59
.gitea/workflows/ci.yaml
Normal file
@@ -0,0 +1,59 @@
|
||||
name: CI/CD
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: linux-amd64
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.25.6'
|
||||
|
||||
- name: Download dependencies
|
||||
working-directory: ./backend
|
||||
run: go mod download
|
||||
|
||||
- name: Build
|
||||
working-directory: ./backend
|
||||
run: go build -v ./...
|
||||
|
||||
- name: Test
|
||||
working-directory: ./backend
|
||||
run: go test -v ./...
|
||||
|
||||
build-and-push:
|
||||
runs-on: linux-amd64
|
||||
needs: test
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Login to Gitea Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: gitea.home.hrajfrisbee.cz
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: ./backend
|
||||
file: ./backend/Dockerfile.prod
|
||||
push: true
|
||||
tags: |
|
||||
gitea.home.hrajfrisbee.cz/${{ github.repository }}/backend:latest
|
||||
gitea.home.hrajfrisbee.cz/${{ github.repository }}/backend:${{ github.sha }}
|
||||
Reference in New Issue
Block a user