67 lines
1.9 KiB
YAML
67 lines
1.9 KiB
YAML
name: Builder
|
|
|
|
on:
|
|
push:
|
|
branches: [main, master]
|
|
pull_request:
|
|
branches: [main, master]
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
name: Build addons
|
|
strategy:
|
|
matrix:
|
|
addon: ["localai-p2p-master", "localai-p2p-worker"]
|
|
arch: ["amd64"] # Ajoutez d'autres architectures si nécessaire
|
|
|
|
steps:
|
|
- name: Check out repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log in to Gitea Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: gitea.votre-domaine.com # Remplacez par votre instance Gitea
|
|
username: ${{ gitea.actor }}
|
|
password: ${{ secrets.GITEA_TOKEN }}
|
|
|
|
- name: Extract version from config
|
|
id: version
|
|
run: |
|
|
VERSION=$(grep '^version:' ${{ matrix.addon }}/config.yaml | sed 's/version: //' | tr -d '"')
|
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
|
|
- name: Build and push addon
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: ./${{ matrix.addon }}
|
|
platforms: linux/${{ matrix.arch }}
|
|
push: true
|
|
tags: |
|
|
gitea.votre-domaine.com/votre-user/ha-${{ matrix.addon }}:latest
|
|
gitea.votre-domaine.com/votre-user/ha-${{ matrix.addon }}:${{ steps.version.outputs.version }}
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|
|
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
name: Create release
|
|
needs: build
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
steps:
|
|
- name: Check out repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Create Release
|
|
uses: actions/create-release@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
|
with:
|
|
tag_name: ${{ github.ref }}
|
|
release_name: Release ${{ github.ref }}
|
|
draft: false
|
|
prerelease: false |