Corrected gh action #4
Workflow file for this run
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: Build and Release CLI | |
| on: | |
| push: | |
| tags: | |
| - 'v*' # Déclencher sur les tags qui commencent par 'v' (v1.0.0, v0.2.0, etc.) | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Get Version from Tag | |
| id: get_version | |
| run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
| - name: List repository structure | |
| run: | | |
| echo "Contenu du répertoire racine:" | |
| ls -la | |
| echo "Contenu du répertoire src (s'il existe):" | |
| if [ -d "src" ]; then | |
| ls -la src/ | |
| fi | |
| echo "Recherche du fichier bashly.yml:" | |
| find . -name "bashly.yml" -type f | |
| - name: Update Version in Bashly Config | |
| run: | | |
| VERSION=$(echo "${{ steps.get_version.outputs.VERSION }}" | sed 's/^v//') | |
| # Rechercher le fichier bashly.yml | |
| BASHLY_CONFIG=$(find . -name "bashly.yml" -type f | head -n 1) | |
| if [ -n "$BASHLY_CONFIG" ]; then | |
| echo "Fichier bashly.yml trouvé: $BASHLY_CONFIG" | |
| sed -i "s/^version:.*/version: $VERSION/" "$BASHLY_CONFIG" | |
| # Stocker le chemin du fichier pour l'étape suivante | |
| echo "BASHLY_CONFIG=$BASHLY_CONFIG" >> $GITHUB_ENV | |
| else | |
| echo "Erreur: fichier bashly.yml non trouvé" | |
| exit 1 | |
| fi | |
| - name: Generate CLI with Bashly Docker | |
| run: | | |
| # Exécuter Bashly dans ce répertoire | |
| docker run --rm --volume "${PWD}:/app" dannyben/bashly generate | |
| # Si nous ne sommes pas à la racine, déplacer l'exécutable généré | |
| if [ "$BASHLY_DIR" != "." ]; then | |
| mv pollora $GITHUB_WORKSPACE/pollora | |
| fi | |
| - name: Make CLI Executable | |
| run: chmod +x pollora | |
| - name: Create Release | |
| id: create_release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ steps.get_version.outputs.VERSION }} | |
| release_name: Release ${{ steps.get_version.outputs.VERSION }} | |
| draft: false | |
| prerelease: false | |
| - name: Upload Release Binary | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ./pollora | |
| asset_name: pollora | |
| asset_content_type: application/octet-stream | |
| - name: Verify Installer Script | |
| run: | | |
| if [ -f "install.sh" ]; then | |
| echo "Fichier install.sh trouvé à la racine" | |
| else | |
| echo "Recherche du fichier install.sh:" | |
| INSTALL_SCRIPT=$(find . -name "install.sh" -type f | head -n 1) | |
| if [ -n "$INSTALL_SCRIPT" ]; then | |
| echo "Fichier install.sh trouvé: $INSTALL_SCRIPT" | |
| cp "$INSTALL_SCRIPT" ./install.sh | |
| else | |
| echo "Avertissement: fichier install.sh non trouvé" | |
| # Créer un fichier install.sh minimal | |
| echo '#!/bin/bash | |
| echo "Installateur temporaire - veuillez créer un fichier install.sh approprié" | |
| exit 1' > install.sh | |
| fi | |
| fi | |
| chmod +x install.sh | |
| - name: Upload Installer Script | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ./install.sh | |
| asset_name: install.sh | |
| asset_content_type: text/x-shellscript |