Files
NaviWatcher/.gitea/workflows/docker-build.yml
Vladimir Zagainov 34bfb80a8c
Some checks failed
Build and Push Docker Image / build (push) Failing after 39s
Build and Push Docker Image / build (pull_request) Failing after 49s
fix
2026-08-05 23:20:34 +03:00

78 lines
2.0 KiB
YAML

name: Build and Push Docker Image
on:
push:
branches: [ "**" ]
tags: [ 'v*' ]
pull_request:
branches: [ master ]
env:
# Docker image configuration - using your Gitea registry
REGISTRY: gitea.mrixs.me
IMAGE_NAME: naviwatcher
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write # Needed for writing to GitHub Packages registry
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.25'
cache: true
- name: Verify dependencies
run: |
go mod tidy
go mod verify
- name: Run unit tests
run: go test ./... -v -coverprofile=coverage.out
- name: Upload coverage report
if: always()
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage.out
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Gitea Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ gitea.repository_owner }}
password: ${{ secrets.PACKAGES_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-buildcache
cache-to: type=inline,mode=max