Files
watcher-visio/.gitea/workflows/docker-build.yml
Nikolay Tatarinov 1baa6e7e6b
Some checks failed
CI / ci (push) Has been cancelled
Add initial project configuration and CI/CD workflows
- Created pyproject.toml to define project metadata and dependencies for the watcher-visio dashboard.
- Added CI workflow in ci.yml for automated testing, linting, and security checks on push and pull request events.
- Introduced docker-build.yml for building and releasing Docker images, including steps for tagging, logging in to the registry, and generating release notes.
2026-02-07 17:49:58 +03:00

75 lines
2.2 KiB
YAML

name: Docker build and release
on:
push:
branches: [main]
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
outputs:
tag: ${{ steps.meta.outputs.tag }}
steps:
- name: Checkout
uses: https://gitea.com/actions/checkout@v4
with:
fetch-depth: 0
- name: Set release tag
id: meta
run: |
echo "tag=v$(date +%Y%m%d)-${GITHUB_SHA:0:7}" >> $GITHUB_OUTPUT
- name: Extract registry host
id: registry
run: |
echo "host=${GITHUB_SERVER_URL#https://}" >> $GITHUB_OUTPUT
- name: Log in to Gitea Container Registry
run: |
echo "${{ secrets.REGISTRY_TOKEN }}" | docker login ${{ steps.registry.outputs.host }} -u ${{ github.actor }} --password-stdin
- name: Build and push
run: |
IMAGE="${{ steps.registry.outputs.host }}/${{ github.repository }}"
TAG="${{ steps.meta.outputs.tag }}"
docker build -t "$IMAGE:$TAG" -t "$IMAGE:latest" .
docker push "$IMAGE:$TAG"
docker push "$IMAGE:latest"
release:
runs-on: ubuntu-latest
needs: build-and-push
permissions:
contents: write
steps:
- name: Checkout
uses: https://gitea.com/actions/checkout@v4
with:
fetch-depth: 0
- name: Generate release notes
id: notes
run: |
PREV=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
if [ -z "$PREV" ]; then
echo "## Changes" > release_notes.md
echo "" >> release_notes.md
git log --pretty=format:"- %s (%h)" >> release_notes.md || echo "- Initial release" >> release_notes.md
else
echo "## Changes since $PREV" > release_notes.md
echo "" >> release_notes.md
git log "$PREV"..HEAD --pretty=format:"- %s (%h)" >> release_notes.md
fi
- name: Create release
uses: https://gitea.com/actions/gitea-release-action@v1
with:
token: ${{ secrets.REGISTRY_TOKEN }}
tag_name: ${{ needs.build-and-push.outputs.tag }}
body_path: release_notes.md
target_commitish: ${{ github.sha }}