docs(data): Fixes #10 - Ajout MPD #9
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: 'Workflow Hotfix' | |
| permissions: | |
| contents: write | |
| on: | |
| pull_request: | |
| types: [closed] | |
| branches: | |
| - main | |
| - dev | |
| jobs: | |
| hotfix: | |
| runs-on: ubuntu-latest | |
| if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'hotfix/') | |
| steps: | |
| - name: 'Checkout code' | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: 'Configurer Git' | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: 'Déterminer la version hotfix' | |
| id: semver | |
| run: | | |
| set -e | |
| # Récupérer le dernier tag vX.Y.Z | |
| LATEST_TAG=$(git tag --sort=-v:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | head -n 1) | |
| if [[ -z "$LATEST_TAG" ]]; then | |
| VERSION="0.0.1" | |
| else | |
| VERSION="${LATEST_TAG#v}" | |
| MAJOR=$(echo "$VERSION" | cut -d. -f1) | |
| MINOR=$(echo "$VERSION" | cut -d. -f2) | |
| PATCH=$(echo "$VERSION" | cut -d. -f3) | |
| PATCH=$((PATCH + 1)) | |
| VERSION="$MAJOR.$MINOR.$PATCH" | |
| fi | |
| TAG="v$VERSION" | |
| # Vérifier si le tag existe déjà | |
| if git rev-parse "$TAG" >/dev/null 2>&1; then | |
| echo "skip=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "skip=false" >> $GITHUB_OUTPUT | |
| fi | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "tag=$TAG" >> $GITHUB_OUTPUT | |
| - name: 'Créer le tag et la release si sur main' | |
| if: steps.semver.outputs.skip != 'true' && github.event.pull_request.base.ref == 'main' | |
| run: | | |
| echo "Récupération du changelog pour ${{ steps.semver.outputs.tag }}" | |
| # Extraire le changelog correspondant à la version | |
| RELEASE_NOTES=$(awk "/^## \[${{ steps.semver.outputs.tag }}\]/ {flag=1; next} /^## / {flag=0} flag" CHANGELOG.md) | |
| echo "$RELEASE_NOTES" > release_notes.md | |
| # Créer le tag | |
| git tag "${{ steps.semver.outputs.tag }}" | |
| git push origin "${{ steps.semver.outputs.tag }}" | |
| - name: 'Créer une release GitHub' | |
| if: steps.semver.outputs.skip != 'true' && github.event.pull_request.base.ref == 'main' | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| tag: '${{ steps.semver.outputs.tag }}' | |
| name: 'Hotfix ${{ steps.semver.outputs.tag }}' | |
| body: | | |
| $(cat release_notes.md) | |
| - name: 'PR mergée sur dev' | |
| if: github.event.pull_request.base.ref == 'dev' | |
| run: echo "PR mergée sur dev, aucune release ni tag créé." |