Merge pull request #5 from Ops-Talks/copilot/fix-release-packaging-er… #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: Release | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| artifact: kube-idea-linux | |
| target: linux | |
| - os: macos-latest | |
| artifact: kube-idea-macos | |
| target: macos | |
| - os: windows-latest | |
| artifact: kube-idea-windows | |
| target: windows | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install Poetry | |
| run: pip install poetry | |
| - name: Install dependencies | |
| run: poetry install | |
| - name: Install Linux build dependencies | |
| if: matrix.target == 'linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y clang cmake ninja-build libgtk-3-dev pkg-config | |
| - name: Build desktop binary (non-Windows) | |
| if: matrix.target != 'windows' | |
| run: poetry run flet build ${{ matrix.target }} --yes src/ | |
| - name: Build desktop binary (Windows) | |
| if: matrix.target == 'windows' | |
| run: poetry run flet build ${{ matrix.target }} --yes src/ | |
| env: | |
| PYTHONIOENCODING: utf-8 | |
| - name: Package .deb (Linux) | |
| if: matrix.target == 'linux' | |
| run: | | |
| VERSION="${GITHUB_REF_NAME#v}" | |
| mkdir -p pkg/DEBIAN pkg/opt/kube-idea pkg/usr/bin | |
| cp -r build/* pkg/opt/kube-idea/ | |
| [ -f pkg/opt/kube-idea/kube-idea ] && chmod +x pkg/opt/kube-idea/kube-idea | |
| ln -sf /opt/kube-idea/kube-idea pkg/usr/bin/kube-idea | |
| cat > pkg/DEBIAN/control <<EOF | |
| Package: kube-idea | |
| Version: ${VERSION} | |
| Architecture: amd64 | |
| Maintainer: Ops-Talks <ops-talks@users.noreply.github.com> | |
| Description: Kubernetes IDE desktop application | |
| Section: utils | |
| Priority: optional | |
| EOF | |
| mkdir -p dist | |
| dpkg-deb --root-owner-group --build pkg dist/kube-idea-linux.deb | |
| - name: Package .dmg (macOS) | |
| if: matrix.target == 'macos' | |
| run: | | |
| mkdir -p dist | |
| hdiutil create -volname "Kube-IDEA" -srcfolder build/ \ | |
| -ov -format UDZO dist/kube-idea-macos.dmg | |
| - name: Package .zip (Windows) | |
| if: matrix.target == 'windows' | |
| shell: pwsh | |
| run: | | |
| New-Item -ItemType Directory -Force -Path dist | |
| Compress-Archive -Path build\* -DestinationPath dist\kube-idea-windows.zip | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.artifact }} | |
| path: dist/ | |
| build-fedora: | |
| runs-on: ubuntu-latest | |
| container: | |
| image: fedora:latest | |
| steps: | |
| - name: Install system dependencies | |
| run: | | |
| dnf install -y python3 python3-pip git clang cmake ninja-build \ | |
| gtk3-devel pkg-config tar gzip which | |
| - uses: actions/checkout@v4 | |
| - name: Install Poetry | |
| run: pip3 install poetry | |
| - name: Install dependencies | |
| run: poetry install | |
| - name: Build desktop binary | |
| run: poetry run flet build linux --yes src/ | |
| - name: Package archive | |
| run: | | |
| mkdir -p dist | |
| tar -czf dist/kube-idea-fedora.tar.gz -C build . | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: kube-idea-fedora | |
| path: dist/ | |
| build-flatpak: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install Poetry | |
| run: pip install poetry | |
| - name: Install dependencies | |
| run: poetry install | |
| - name: Install Linux build and Flatpak dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y clang cmake ninja-build libgtk-3-dev pkg-config \ | |
| flatpak flatpak-builder | |
| - name: Build desktop binary | |
| run: poetry run flet build linux --yes src/ | |
| - name: Install Flatpak runtime | |
| run: | | |
| flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo | |
| flatpak install -y --noninteractive flathub \ | |
| org.freedesktop.Platform//24.08 org.freedesktop.Sdk//24.08 | |
| - name: Prepare Flatpak sources | |
| run: | | |
| mkdir -p flatpak/bin | |
| cp -r build/* flatpak/bin/ | |
| - name: Build Flatpak bundle | |
| run: | | |
| flatpak-builder --repo=flatpak-repo --force-clean \ | |
| flatpak-build flatpak/io.github.ops_talks.KubeIdea.yml | |
| mkdir -p dist | |
| flatpak build-bundle flatpak-repo dist/kube-idea.flatpak \ | |
| io.github.ops_talks.KubeIdea | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: kube-idea-flatpak | |
| path: dist/ | |
| release: | |
| needs: [build, build-fedora, build-flatpak] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts/ | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| generate_release_notes: true | |
| files: | | |
| artifacts/kube-idea-linux/kube-idea-linux.deb | |
| artifacts/kube-idea-macos/kube-idea-macos.dmg | |
| artifacts/kube-idea-windows/kube-idea-windows.zip | |
| artifacts/kube-idea-fedora/kube-idea-fedora.tar.gz | |
| artifacts/kube-idea-flatpak/kube-idea.flatpak |