Added Github Actions

This commit is contained in:
ewen 2026-01-15 23:27:09 +01:00
parent 8a88d8243d
commit 4664379340
2 changed files with 134 additions and 0 deletions

52
.github/workflows/auto-tag.yml vendored Normal file
View file

@ -0,0 +1,52 @@
name: Auto Tag on Push
on:
push:
branches:
- main
paths-ignore:
- '**.md'
- '.github/**'
jobs:
auto-tag:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Récupère tout l'historique pour les tags
- name: Get latest tag
id: get_tag
run: |
# Récupère le dernier tag v0.x.x
LATEST_TAG=$(git tag -l "v0.*.*" | sort -V | tail -n 1)
if [ -z "$LATEST_TAG" ]; then
# Pas de tag existant, on commence à v0.1.0
NEW_TAG="v0.1.0"
else
# Extrait les numéros de version
VERSION=${LATEST_TAG#v}
MAJOR=$(echo $VERSION | cut -d. -f1)
MINOR=$(echo $VERSION | cut -d. -f2)
PATCH=$(echo $VERSION | cut -d. -f3)
# Incrémente le patch
NEW_PATCH=$((PATCH + 1))
NEW_TAG="v${MAJOR}.${MINOR}.${NEW_PATCH}"
fi
echo "new_tag=$NEW_TAG" >> $GITHUB_OUTPUT
echo "Nouveau tag: $NEW_TAG"
- name: Create and push tag
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
git tag ${{ steps.get_tag.outputs.new_tag }}
git push origin ${{ steps.get_tag.outputs.new_tag }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

82
.github/workflows/build-release.yml vendored Normal file
View file

@ -0,0 +1,82 @@
name: Build and Release DMG
on:
push:
tags:
- 'v0.*.*' # Accepte v0.1.0, v0.2.5, etc.
- 'v[1-9].*.*' # Accepte aussi v1.0.0+ pour le futur
workflow_dispatch:
jobs:
build:
runs-on: macos-14
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '15.2'
- name: Resolve Swift Package Dependencies
run: |
xcodebuild -resolvePackageDependencies \
-scheme iDither
- name: Build app
run: |
xcodebuild -scheme iDither \
-configuration Release \
-derivedDataPath ./build \
-destination 'platform=macOS' \
clean build
- name: Create DMG
run: |
# Trouve l'app compilée
APP_PATH=$(find ./build/Build/Products/Release -name "iDither.app" -type d | head -n 1)
if [ -z "$APP_PATH" ]; then
echo "❌ App non trouvée dans le build"
exit 1
fi
echo "✅ App trouvée : $APP_PATH"
# Crée un dossier temporaire pour le DMG
mkdir -p dmg_content
cp -R "$APP_PATH" dmg_content/
# Ajoute un lien vers /Applications (pratique pour l'installation)
ln -s /Applications dmg_content/Applications
# Crée le DMG
hdiutil create -volname "iDither" \
-srcfolder dmg_content \
-ov -format UDZO \
iDither-${{ github.ref_name }}.dmg
echo "✅ DMG créé : iDither-${{ github.ref_name }}.dmg"
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: iDither-*.dmg
draft: false
prerelease: ${{ startsWith(github.ref, 'refs/tags/v0.') }} # v0.x.x = prerelease
body: |
## iDither ${{ github.ref_name }}
Application macOS de dithering en temps réel.
### Installation
1. Téléchargez le fichier `.dmg`
2. Ouvrez-le et glissez iDither vers Applications
3. Au premier lancement, faites clic droit → Ouvrir (sécurité macOS)
---
Build automatique via GitHub Actions
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}