From 76388008cccae98694621bda30c80f5d4027066d Mon Sep 17 00:00:00 2001 From: Florent Champigny Date: Thu, 12 Nov 2026 11:15:59 +0100 Subject: [PATCH] Add automated release workflow Co-Authored-By: Claude Sonnet 5.5 --- .github/release.yml | 12 ++++++++ .github/workflows/release.yml | 57 +++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 .github/release.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 0000000..00d6d82 --- /dev/null +++ b/.github/release.yml @@ -0,0 +1,12 @@ +changelog: + exclude: + labels: [skip-changelog] + categories: + - title: Breaking changes + labels: [breaking] + - title: New features + labels: [feature, enhancement] + - title: Fixes + labels: [bug, fix] + - title: Other changes + labels: ["*"] diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..74ab597 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,57 @@ +name: Release + +# Déclenché par FloconSwift (même numéro de version), ou à la main. +# Aligne la dépendance FloconSwift sur la version, commit sur main, tag + release GitHub (changelog généré). + +on: + workflow_dispatch: + inputs: + version: + description: "Version SemVer, sans 'v' (ex: 2.1.0), identique à FloconSwift" + required: true + type: string + +permissions: + contents: write + +concurrency: release + +jobs: + release: + runs-on: macos-latest + env: + VERSION: ${{ inputs.version }} + GH_TOKEN: ${{ github.token }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Validate version + run: | + [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$ ]] || { echo "::error::Version invalide: $VERSION"; exit 1; } + [[ "${{ github.ref_name }}" == "main" ]] || { echo "::error::Lancer depuis main"; exit 1; } + ! git rev-parse -q --verify "refs/tags/$VERSION" || { echo "::error::Le tag $VERSION existe déjà"; exit 1; } + + - name: Bump FloconSwift dependency + run: | + sed -i '' -E "s|(openflocon/FloconSwift\.git\", from: \")[^\"]+|\1$VERSION|" Package.swift + grep -q "FloconSwift.git\", from: \"$VERSION\"" Package.swift + + - name: Build against the new FloconSwift + run: swift build + + - name: Commit bump + run: | + if ! git diff --quiet; then + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git commit -am "Bump FloconSwift to $VERSION" + git push origin HEAD:main + fi + + - name: Create tag and GitHub release (generated changelog) + run: | + flags=() + [[ "$VERSION" == *-* ]] && flags+=(--prerelease) + gh release create "$VERSION" --target "$(git rev-parse HEAD)" --title "$VERSION" --generate-notes "${flags[@]}"