[release] Merge pull request #25 from N3koSempai/feat/backups #158
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: Release Build | |
| on: | |
| push: | |
| branches: | |
| - master | |
| paths-ignore: | |
| - '**.md' | |
| - '.gitignore' | |
| workflow_dispatch: | |
| jobs: | |
| check-release: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| should_release: ${{ steps.check.outputs.should_release }} | |
| version: ${{ steps.check.outputs.version }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 2 | |
| - name: Check for [release] in commit message | |
| id: check | |
| run: | | |
| COMMIT_MSG=$(git log -1 --pretty=%B) | |
| if echo "$COMMIT_MSG" | grep -q "\[release\]"; then | |
| echo "should_release=true" >> $GITHUB_OUTPUT | |
| # Extract version from package.json | |
| VERSION=$(grep -oP '"version":\s*"\K[^"]+' package.json) | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "Release triggered with version $VERSION" | |
| else | |
| echo "should_release=false" >> $GITHUB_OUTPUT | |
| echo "No [release] tag found in commit message" | |
| fi | |
| build-flatpak: | |
| needs: check-release | |
| if: needs.check-release.outputs.should_release == 'true' | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| # 1. Limpieza estándar (sin redimensionar particiones, es más seguro) | |
| - name: Free Disk Space | |
| uses: jlumbroso/free-disk-space@main | |
| with: | |
| tool-cache: true | |
| android: true | |
| dotnet: true | |
| haskell: true | |
| large-packages: true | |
| docker-images: true | |
| swap-storage: true | |
| - uses: actions/checkout@v4 | |
| # 2. EL TRUCO MAESTRO: Redirigir Flatpak al disco de 75GB (/mnt) | |
| - name: Redirect Flatpak Storage to /mnt | |
| run: | | |
| echo "Espacio antes del truco:" | |
| df -h | |
| # Crear carpeta en el disco gigante | |
| sudo mkdir -p /mnt/flatpak-storage | |
| sudo chown -R $USER:$USER /mnt/flatpak-storage | |
| # Crear la estructura local | |
| mkdir -p ~/.local/share | |
| # Crear el enlace simbólico: Todo lo que vaya a ~/.local/share/flatpak | |
| # realmente se guardará en /mnt/flatpak-storage (75GB libres) | |
| ln -s /mnt/flatpak-storage ~/.local/share/flatpak | |
| echo "Enlace creado. Flatpak usará /mnt." | |
| # 3. Instalación de herramientas | |
| - name: Install Flatpak & Builder | |
| run: | | |
| sudo add-apt-repository ppa:flatpak/stable -y | |
| sudo apt-get update | |
| sudo apt-get install -y flatpak flatpak-builder | |
| flatpak-builder --version | |
| flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo | |
| # 4. Instalar SDKs (Ahora irán al disco gigante) | |
| - name: Install Runtime & SDKs | |
| run: | | |
| flatpak install --user -y flathub org.gnome.Sdk//49 org.gnome.Platform//49 | |
| flatpak install --user -y flathub org.freedesktop.Sdk.Extension.rust-stable//25.08 | |
| flatpak install --user -y flathub org.freedesktop.Sdk.Extension.node20//25.08 | |
| # 5. Compilar (Usando --sandbox para aislar) | |
| - name: Build Flatpak | |
| run: | | |
| # Importante: XDG_DATA_HOME fuerza a usar nuestras rutas locales | |
| export XDG_DATA_HOME=$HOME/.local/share | |
| flatpak-builder --user --repo=repo --force-clean build-dir io.github.N3kosempai.klia-store.yml | |
| flatpak build-bundle repo Klia-Store-${{ needs.check-release.outputs.version }}.flatpak io.github.N3kosempai.klia-store | |
| - name: Upload Flatpak artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: flatpak-package | |
| path: Klia-Store-*.flatpak | |
| create-release: | |
| needs: [check-release, build-flatpak] | |
| if: needs.check-release.outputs.should_release == 'true' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download Flatpak artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: flatpak-package | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: v${{ needs.check-release.outputs.version }} | |
| name: Release v${{ needs.check-release.outputs.version }} | |
| draft: false | |
| prerelease: false | |
| files: | | |
| Klia-Store-*.flatpak | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |