Compare commits
2 Commits
3.0
...
66883b92af
Author | SHA1 | Date | |
---|---|---|---|
66883b92af | |||
3a8dd3ca09 |
@ -6,6 +6,10 @@ on:
|
||||
tag:
|
||||
description: 'Nom du tag (ex: v1.2.3)'
|
||||
required: true
|
||||
branche:
|
||||
description: 'Branche cible (ex: master)'
|
||||
default: 'master'
|
||||
required: true
|
||||
build_apk:
|
||||
description: 'Compiler et publier l’APK ?'
|
||||
required: true
|
||||
@ -29,23 +33,11 @@ jobs:
|
||||
- name: 🔧 Préparation de Git (tags)
|
||||
run: git fetch --tags
|
||||
|
||||
- name: 🏷️ Créer le tag si nécessaire
|
||||
run: |
|
||||
TAG="${{ github.event.inputs.tag }}"
|
||||
if git rev-parse "$TAG" >/dev/null 2>&1; then
|
||||
echo "Le tag $TAG existe déjà, pas besoin de le créer."
|
||||
else
|
||||
git config user.name "github-actions"
|
||||
git config user.email "github-actions@github.com"
|
||||
git tag "$TAG"
|
||||
git push origin "$TAG"
|
||||
fi
|
||||
|
||||
- name: 🔖 Détection du tag précédent
|
||||
id: tag-precedent
|
||||
run: |
|
||||
TARGET_TAG="${{ github.event.inputs.tag }}"
|
||||
TAGS=$(git tag --sort=creatordate)
|
||||
CURRENT_TAG="${{ github.event.inputs.tag }}"
|
||||
TAGS=$(git tag --sort=-creatordate)
|
||||
|
||||
if [ -z "$TAGS" ]; then
|
||||
echo "Aucun tag existant détecté."
|
||||
@ -54,16 +46,19 @@ jobs:
|
||||
fi
|
||||
|
||||
PREV_TAG=""
|
||||
FOUND=false
|
||||
|
||||
for tag in $TAGS; do
|
||||
if [ "$tag" != "$TARGET_TAG" ]; then
|
||||
if [ "$FOUND" = true ]; then
|
||||
PREV_TAG=$tag
|
||||
else
|
||||
break
|
||||
fi
|
||||
if [ "$tag" = "$CURRENT_TAG" ]; then
|
||||
FOUND=true
|
||||
fi
|
||||
done
|
||||
|
||||
echo "tag_precedent=$PREV_TAG" | tee -a $GITHUB_OUTPUT
|
||||
echo "tag_precedent=$PREV_TAG" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: 📝 Liste des modifications
|
||||
id: changelog
|
||||
@ -86,6 +81,18 @@ jobs:
|
||||
echo "$LOG" >> $GITHUB_OUTPUT
|
||||
echo "EOF" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: 🏷️ Créer le tag si nécessaire
|
||||
run: |
|
||||
TAG="${{ github.event.inputs.tag }}"
|
||||
if git rev-parse "$TAG" >/dev/null 2>&1; then
|
||||
echo "Le tag $TAG existe déjà, pas besoin de le créer."
|
||||
else
|
||||
git config user.name "github-actions"
|
||||
git config user.email "github-actions@github.com"
|
||||
git tag "$TAG"
|
||||
git push origin "$TAG"
|
||||
fi
|
||||
|
||||
- name: 📦 Création de la version sur Gitea
|
||||
id: creation-release
|
||||
env:
|
||||
@ -95,6 +102,7 @@ jobs:
|
||||
COMMITS: ${{ steps.changelog.outputs.modifications }}
|
||||
run: |
|
||||
TAG_NAME="${{ github.event.inputs.tag }}"
|
||||
BRANCHE="${{ github.event.inputs.branche }}"
|
||||
|
||||
# Échappement du contenu pour JSON
|
||||
DESCRIPTION="Changelog:"$'\n'"$COMMITS"
|
||||
@ -105,6 +113,7 @@ jobs:
|
||||
-H "Authorization: token $TOKEN" \
|
||||
-d "{
|
||||
\"tag_name\": \"$TAG_NAME\",
|
||||
\"target\": \"$BRANCHE\",
|
||||
\"name\": \"Version $TAG_NAME\",
|
||||
\"body\": $ESCAPED_DESCRIPTION
|
||||
}")
|
||||
@ -122,10 +131,8 @@ jobs:
|
||||
APP_NAME=$(grep 'rootProject.name' settings.gradle | sed -E 's/.*= "(.*)"/\1/')
|
||||
COMPILE_SDK_VERSION=$(grep 'compileSdk' app/build.gradle | grep -oE '[0-9]+')
|
||||
|
||||
{
|
||||
echo "app_name=$APP_NAME"
|
||||
echo "sdk=$COMPILE_SDK_VERSION"
|
||||
} | tee -a $GITHUB_OUTPUT
|
||||
echo "app_name=$APP_NAME" >> $GITHUB_OUTPUT
|
||||
echo "compile_sdk_version=$COMPILE_SDK_VERSION" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: ☕ Configurer Java
|
||||
if: ${{ github.event.inputs.build_apk == 'oui' }}
|
||||
@ -138,8 +145,8 @@ jobs:
|
||||
if: ${{ github.event.inputs.build_apk == 'oui' }}
|
||||
uses: android-actions/setup-android@v3
|
||||
with:
|
||||
api-level: ${{ steps.extraire-info-gradle.outputs.sdk }}
|
||||
build-tools-version: ${{ steps.extraire-info-gradle.outputs.sdk }}.0.3
|
||||
api-level: ${{ steps.extraire-info-gradle.outputs.compile_sdk_version }}
|
||||
build-tools-version: ${{ steps.extraire-info-gradle.outputs.compile_sdk_version }}.0.3
|
||||
|
||||
- name: 🛠️ Compilation de l’application (APK)
|
||||
if: ${{ github.event.inputs.build_apk == 'oui' }}
|
||||
|
Reference in New Issue
Block a user