[release] trigger debug disable version #85
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-deb: | |
| needs: check-release | |
| if: needs.check-release.outputs.should_release == 'true' | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| libwebkit2gtk-4.1-dev \ | |
| build-essential \ | |
| curl \ | |
| wget \ | |
| file \ | |
| libxdo-dev \ | |
| libssl-dev \ | |
| libayatana-appindicator3-dev \ | |
| librsvg2-dev | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Build Tauri .deb | |
| run: npm run tauri build -- --bundles deb | |
| - name: Rename .deb file | |
| run: | | |
| VERSION="${{ needs.check-release.outputs.version }}" | |
| DEB_FILE=$(find src-tauri/target/release/bundle/deb -name "*.deb" -type f) | |
| mv "$DEB_FILE" "Klia-Store-${VERSION}.deb" | |
| - name: Upload .deb artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: deb-package | |
| path: Klia-Store-*.deb | |
| build-flatpak: | |
| needs: check-release | |
| if: needs.check-release.outputs.should_release == 'true' | |
| runs-on: ubuntu-22.04 | |
| container: | |
| image: bilelmoussaoui/flatpak-github-actions:gnome-47 | |
| options: --privileged | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Build Flatpak | |
| uses: flatpak/flatpak-github-actions/flatpak-builder@v6 | |
| with: | |
| bundle: Klia-Store-${{ needs.check-release.outputs.version }}.flatpak | |
| manifest-path: io.github.N3kosempai.klia-store.yml | |
| cache-key: flatpak-builder-${{ github.sha }} | |
| - name: Upload Flatpak artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: flatpak-package | |
| path: Klia-Store-*.flatpak | |
| create-release: | |
| needs: [check-release, build-deb, build-flatpak] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download .deb artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: deb-package | |
| - name: Download Flatpak artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: flatpak-package | |
| - name: Extract release notes from metainfo | |
| id: extract_notes | |
| run: | | |
| VERSION="${{ needs.check-release.outputs.version }}" | |
| # Extract the description for the current version from metainfo.xml | |
| NOTES=$(python3 << 'EOF' | |
| import xml.etree.ElementTree as ET | |
| import sys | |
| try: | |
| tree = ET.parse('io.github.N3kosempai.klia-store.metainfo.xml') | |
| root = tree.getroot() | |
| version = "${{ needs.check-release.outputs.version }}" | |
| # Find the release with matching version | |
| for release in root.findall('.//release'): | |
| if release.get('version') == version: | |
| desc = release.find('description') | |
| if desc is not None: | |
| # Extract text content from description | |
| lines = [] | |
| for elem in desc.iter(): | |
| if elem.text and elem.text.strip(): | |
| lines.append(elem.text.strip()) | |
| if elem.tail and elem.tail.strip(): | |
| lines.append(elem.tail.strip()) | |
| print('\n'.join(lines)) | |
| break | |
| except Exception as e: | |
| print(f"Error: {e}", file=sys.stderr) | |
| EOF | |
| ) | |
| # If extraction fails, use commit message as fallback | |
| if [ -z "$NOTES" ]; then | |
| NOTES="${{ github.event.head_commit.message }}" | |
| fi | |
| # Save to output (handle multiline) | |
| echo "notes<<EOF" >> $GITHUB_OUTPUT | |
| echo "$NOTES" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: v${{ needs.check-release.outputs.version }} | |
| name: Klia Store ${{ needs.check-release.outputs.version }} | |
| draft: false | |
| prerelease: false | |
| body: | | |
| ## Klia Store ${{ needs.check-release.outputs.version }} | |
| ### What's New | |
| ${{ steps.extract_notes.outputs.notes }} | |
| ### Installation | |
| **Debian/Ubuntu (.deb):** | |
| ```bash | |
| sudo dpkg -i Klia-Store-${{ needs.check-release.outputs.version }}.deb | |
| ``` | |
| **Flatpak:** | |
| ```bash | |
| flatpak install Klia-Store-${{ needs.check-release.outputs.version }}.flatpak | |
| flatpak run io.github.N3kosempai.klia-store | |
| ``` | |
| files: | | |
| Klia-Store-*.deb | |
| Klia-Store-*.flatpak |