|
| 1 | +name: Release Build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "*" |
| 7 | + |
| 8 | +env: |
| 9 | + UV_PYTHON: 3.11 # Python version |
| 10 | + PYTHONUTF8: 1 |
| 11 | + |
| 12 | + # https://docs.flet.dev/publish/ |
| 13 | + BUILD_NUMBER: 1 |
| 14 | + BUILD_VERSION: 1.0.0 |
| 15 | + |
| 16 | + # https://docs.flet.dev/reference/environment-variables |
| 17 | + FLET_CLI_NO_RICH_OUTPUT: 1 |
| 18 | + |
| 19 | +jobs: |
| 20 | + build: |
| 21 | + name: Build ${{ matrix.name }} |
| 22 | + runs-on: ${{ matrix.runner }} |
| 23 | + strategy: |
| 24 | + fail-fast: false |
| 25 | + matrix: |
| 26 | + include: |
| 27 | + # -------- Desktop -------- |
| 28 | + - name: linux |
| 29 | + runner: ubuntu-latest |
| 30 | + build_cmd: "flet build linux --yes --verbose --build-number=$BUILD_NUMBER --build-version=$BUILD_VERSION" |
| 31 | + artifact_path: build/linux |
| 32 | + needs_linux_deps: true |
| 33 | + |
| 34 | + - name: macos |
| 35 | + runner: macos-latest |
| 36 | + build_cmd: "flet build macos --yes --verbose --build-number=$BUILD_NUMBER --build-version=$BUILD_VERSION" |
| 37 | + artifact_path: build/macos |
| 38 | + needs_linux_deps: false |
| 39 | + |
| 40 | + - name: windows |
| 41 | + runner: windows-latest |
| 42 | + build_cmd: "flet build windows --yes --verbose --build-number=$BUILD_NUMBER --build-version=$BUILD_VERSION" |
| 43 | + artifact_path: build/windows |
| 44 | + needs_linux_deps: false |
| 45 | + |
| 46 | + steps: |
| 47 | + - name: Checkout repository |
| 48 | + uses: actions/checkout@v4 |
| 49 | + |
| 50 | + - name: Setup uv |
| 51 | + uses: astral-sh/setup-uv@v6 |
| 52 | + |
| 53 | + - name: Install Linux dependencies |
| 54 | + if: matrix.needs_linux_deps |
| 55 | + shell: bash |
| 56 | + run: | |
| 57 | + sudo apt update --allow-releaseinfo-change |
| 58 | + sudo apt-get install -y --no-install-recommends \ |
| 59 | + clang \ |
| 60 | + ninja-build \ |
| 61 | + libgtk-3-dev \ |
| 62 | + libasound2-dev \ |
| 63 | + libmpv-dev \ |
| 64 | + mpv \ |
| 65 | + libgstreamer1.0-dev \ |
| 66 | + libgstreamer-plugins-base1.0-dev \ |
| 67 | + libgstreamer-plugins-bad1.0-dev \ |
| 68 | + gstreamer1.0-plugins-base \ |
| 69 | + gstreamer1.0-plugins-good \ |
| 70 | + gstreamer1.0-plugins-bad \ |
| 71 | + gstreamer1.0-plugins-ugly \ |
| 72 | + gstreamer1.0-libav \ |
| 73 | + gstreamer1.0-tools \ |
| 74 | + gstreamer1.0-x \ |
| 75 | + gstreamer1.0-alsa \ |
| 76 | + gstreamer1.0-gl \ |
| 77 | + gstreamer1.0-gtk3 \ |
| 78 | + gstreamer1.0-qt5 \ |
| 79 | + gstreamer1.0-pulseaudio \ |
| 80 | + pkg-config \ |
| 81 | + libsecret-1-0 \ |
| 82 | + libsecret-1-dev |
| 83 | + sudo apt-get clean |
| 84 | +
|
| 85 | + - name: Build app |
| 86 | + shell: bash |
| 87 | + run: | |
| 88 | + uv run ${{ matrix.build_cmd }} |
| 89 | +
|
| 90 | + - name: Upload Artifact |
| 91 | + uses: actions/upload-artifact@v5.0.0 |
| 92 | + with: |
| 93 | + name: ${{ matrix.name }}-build-artifact |
| 94 | + path: ${{ matrix.artifact_path }} |
| 95 | + if-no-files-found: error |
| 96 | + overwrite: false |
| 97 | + |
| 98 | + release: |
| 99 | + needs: build |
| 100 | + runs-on: ubuntu-latest |
| 101 | + permissions: |
| 102 | + contents: write |
| 103 | + steps: |
| 104 | + - name: Download all artifacts |
| 105 | + uses: actions/download-artifact@v4 |
| 106 | + with: |
| 107 | + path: artifacts |
| 108 | + merge-multiple: false |
| 109 | + |
| 110 | + - name: Rename artifacts with version tag |
| 111 | + run: | |
| 112 | + TAG_NAME="${GITHUB_REF#refs/tags/}" |
| 113 | + mv artifacts/linux-build-artifact "artifacts/linux-${TAG_NAME}" |
| 114 | + mv artifacts/macos-build-artifact "artifacts/macos-${TAG_NAME}" |
| 115 | + mv artifacts/windows-build-artifact "artifacts/windows-${TAG_NAME}" |
| 116 | + ls -la artifacts/ |
| 117 | +
|
| 118 | + - name: Zip artifacts |
| 119 | + run: | |
| 120 | + TAG_NAME="${GITHUB_REF#refs/tags/}" |
| 121 | + cd artifacts |
| 122 | + zip -r "linux-${TAG_NAME}.zip" "linux-${TAG_NAME}" |
| 123 | + zip -r "macos-${TAG_NAME}.zip" "macos-${TAG_NAME}" |
| 124 | + zip -r "windows-${TAG_NAME}.zip" "windows-${TAG_NAME}" |
| 125 | + ls -la |
| 126 | +
|
| 127 | + - name: Create GitHub Release |
| 128 | + uses: softprops/action-gh-release@v2 |
| 129 | + with: |
| 130 | + name: "Release ${{ github.ref_name }}" |
| 131 | + files: | |
| 132 | + artifacts/*.zip |
| 133 | + generate_release_notes: true |
| 134 | + env: |
| 135 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments