| 1 | # Builds per README "Quick start": `cargo build -p app`, plus the Apple Silicon |
| 2 | # macOS .app from scripts/build-macos.sh and the Linux packages from |
| 3 | # packaging/linux/package.sh. Tests live in test.yml; this file only packages the |
| 4 | # artifacts. |
| 5 | name: Build |
| 6 | |
| 7 | # Builds run for tags (the release assets); pushes are tested in test.yml. |
| 8 | # A `v*` tag also publishes a GitHub release; a tag with `-` (v0.2.0-rc.1) is a pre-release. |
| 9 | # nightly.yml starts it with workflow_dispatch on a nightly tag. |
| 10 | on: |
| 11 | push: |
| 12 | tags: ['*'] |
| 13 | workflow_dispatch: |
| 14 | |
| 15 | permissions: |
| 16 | contents: read |
| 17 | |
| 18 | concurrency: |
| 19 | group: ${{ github.workflow }}-${{ github.ref }} |
| 20 | cancel-in-progress: true |
| 21 | |
| 22 | env: |
| 23 | CARGO_TERM_COLOR: always |
| 24 | |
| 25 | jobs: |
| 26 | linux: |
| 27 | name: Linux |
| 28 | # The oldest supported Ubuntu LTS: the binary needs the glibc it was built |
| 29 | # against, so building here lets it, the AppImage and the deb/rpm run on |
| 30 | # glibc 2.35 and newer. |
| 31 | runs-on: ubuntu-22.04 |
| 32 | timeout-minutes: 90 |
| 33 | # webrtc-sys compiles its C++ against the hermetic libc++ inside the libwebrtc |
| 34 | # artifact, which needs a clang as new as that libc++ (clang 21 today, see |
| 35 | # check_clang_version in vendor/webrtc-sys/build.rs). The distro clang is older |
| 36 | # (18 on ubuntu-24.04), so setup-linux installs clang 21 and these point every |
| 37 | # compile and the final link at it. |
| 38 | env: |
| 39 | CC: clang-21 |
| 40 | CXX: clang++-21 |
| 41 | CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER: clang-21 |
| 42 | steps: |
| 43 | - uses: actions/checkout@v6 |
| 44 | |
| 45 | - uses: ./.github/actions/setup-linux |
| 46 | |
| 47 | - uses: dtolnay/rust-toolchain@stable |
| 48 | |
| 49 | # Its own key: build scripts cached on a newer Ubuntu would need a newer glibc. |
| 50 | - uses: Swatinem/rust-cache@v2 |
| 51 | with: |
| 52 | key: build-ubuntu-22.04 |
| 53 | |
| 54 | - name: Build |
| 55 | run: cargo build -p app --release |
| 56 | |
| 57 | # Before packaging. A later Flatpak or package failure must not drop the binary. |
| 58 | - uses: actions/upload-artifact@v7 |
| 59 | with: |
| 60 | name: teams-linux-amd64 |
| 61 | path: target/release/teams |
| 62 | if-no-files-found: error |
| 63 | |
| 64 | # nfpm builds the deb and rpm, zsync the AppImage's .zsync; desktop-file-utils |
| 65 | # and appstream validate the metadata. AppImage tooling is downloaded by |
| 66 | # package.sh at pinned digests. |
| 67 | - name: Install packaging tools |
| 68 | env: |
| 69 | NFPM_VERSION: 2.48.0 |
| 70 | NFPM_SHA256: 787af76e172dd5fc7cedf4d7c5a090a2f62be9001557a4db1103e270f90ddefd |
| 71 | run: | |
| 72 | sudo apt-get install --no-install-recommends -y zsync desktop-file-utils appstream |
| 73 | curl -fsSL -o "$RUNNER_TEMP/nfpm.deb" \ |
| 74 | "https://github.com/goreleaser/nfpm/releases/download/v$NFPM_VERSION/nfpm_${NFPM_VERSION}_amd64.deb" |
| 75 | echo "$NFPM_SHA256 $RUNNER_TEMP/nfpm.deb" | sha256sum -c - |
| 76 | sudo dpkg -i "$RUNNER_TEMP/nfpm.deb" |
| 77 | |
| 78 | # A tag build carries the tag's version (v0.5.0-rc.1 -> 0.5.0~rc.1 in the deb). |
| 79 | - name: Package |
| 80 | env: |
| 81 | RUSTY_TEAMS_VERSION: ${{ github.ref_type == 'tag' && github.ref_name || '' }} |
| 82 | run: packaging/linux/package.sh --skip-build --formats "appimage deb rpm" |
| 83 | |
| 84 | # deb, rpm, AppImage and its .zsync. Uploaded before Arch and Flatpak, so a |
| 85 | # later failure leaves these artifacts in the run. |
| 86 | - uses: actions/upload-artifact@v7 |
| 87 | with: |
| 88 | name: teams-linux-packages |
| 89 | path: dist/release/* |
| 90 | if-no-files-found: error |
| 91 | |
| 92 | # Arch is its own artifact. A failure here does not drop deb/rpm/AppImage, |
| 93 | # and Flatpak still runs. The job goes red at the end if either is missing. |
| 94 | - name: Arch |
| 95 | id: arch |
| 96 | continue-on-error: true |
| 97 | env: |
| 98 | RUSTY_TEAMS_VERSION: ${{ github.ref_type == 'tag' && github.ref_name || '' }} |
| 99 | run: packaging/linux/package.sh --skip-build --formats archlinux |
| 100 | |
| 101 | - uses: actions/upload-artifact@v7 |
| 102 | if: steps.arch.outcome == 'success' |
| 103 | with: |
| 104 | name: teams-linux-arch |
| 105 | path: dist/release/*.pkg.tar.zst |
| 106 | if-no-files-found: error |
| 107 | |
| 108 | # The Flatpak repackages a tarball built only for it; the release keeps its own tarball. |
| 109 | - name: Flatpak |
| 110 | id: flatpak |
| 111 | continue-on-error: true |
| 112 | env: |
| 113 | RUSTY_TEAMS_VERSION: ${{ github.ref_type == 'tag' && github.ref_name || '' }} |
| 114 | run: | |
| 115 | # 22.04's flatpak-builder 1.2 still calls appstream-compose, which the 26.08 SDK dropped. |
| 116 | sudo add-apt-repository -y ppa:flatpak/stable |
| 117 | sudo apt-get install --no-install-recommends -y flatpak flatpak-builder |
| 118 | DIST="$RUNNER_TEMP/flatpak" packaging/linux/package.sh --skip-build --formats tar |
| 119 | packaging/linux/flatpak-bundle.sh --no-test "$RUNNER_TEMP"/flatpak/rusty-teams-*-linux-x86_64.tar.gz |
| 120 | |
| 121 | - uses: actions/upload-artifact@v7 |
| 122 | if: steps.flatpak.outcome == 'success' |
| 123 | with: |
| 124 | name: teams-linux-flatpak |
| 125 | path: dist/release/*.flatpak |
| 126 | if-no-files-found: error |
| 127 | |
| 128 | - name: Require Arch and Flatpak |
| 129 | if: steps.arch.outcome != 'success' || steps.flatpak.outcome != 'success' |
| 130 | run: | |
| 131 | echo "arch=${{ steps.arch.outcome }} flatpak=${{ steps.flatpak.outcome }}" |
| 132 | exit 1 |
| 133 | |
| 134 | windows: |
| 135 | name: Windows |
| 136 | runs-on: windows-latest |
| 137 | timeout-minutes: 90 |
| 138 | defaults: |
| 139 | run: |
| 140 | shell: bash |
| 141 | steps: |
| 142 | - uses: actions/checkout@v6 |
| 143 | |
| 144 | - uses: dtolnay/rust-toolchain@stable |
| 145 | |
| 146 | - uses: Swatinem/rust-cache@v2 |
| 147 | with: |
| 148 | key: build |
| 149 | |
| 150 | # After the toolchain: staging runs `cargo metadata`. |
| 151 | - uses: ./.github/actions/setup-windows |
| 152 | |
| 153 | # fxc.exe comes from the Windows SDK, gpui-pre-windows finds it through the registry. |
| 154 | - name: Build |
| 155 | run: cargo build -p app --release --config "patch.crates-io.gpui-pre-windows.path=\"$GPUI_PRE_WINDOWS_PATCHED\"" |
| 156 | |
| 157 | # The runner is x86_64; the artifact name carries the architecture. |
| 158 | - uses: actions/upload-artifact@v7 |
| 159 | with: |
| 160 | name: teams-windows-amd64 |
| 161 | path: target/release/teams.exe |
| 162 | |
| 163 | windows-arm: |
| 164 | name: Windows ARM64 |
| 165 | runs-on: windows-11-arm |
| 166 | timeout-minutes: 90 |
| 167 | defaults: |
| 168 | run: |
| 169 | shell: bash |
| 170 | steps: |
| 171 | - uses: actions/checkout@v6 |
| 172 | |
| 173 | - uses: dtolnay/rust-toolchain@stable |
| 174 | |
| 175 | - uses: Swatinem/rust-cache@v2 |
| 176 | with: |
| 177 | key: build-windows-arm |
| 178 | |
| 179 | # After the toolchain: staging runs `cargo metadata` for aarch64. |
| 180 | - uses: ./.github/actions/setup-windows |
| 181 | |
| 182 | - name: Build |
| 183 | run: cargo build -p app --release --config "patch.crates-io.gpui-pre-windows.path=\"$GPUI_PRE_WINDOWS_PATCHED\"" |
| 184 | |
| 185 | - uses: actions/upload-artifact@v7 |
| 186 | with: |
| 187 | name: teams-windows-arm64 |
| 188 | path: target/release/teams.exe |
| 189 | |
| 190 | macos: |
| 191 | name: macOS |
| 192 | runs-on: macos-latest |
| 193 | timeout-minutes: 90 |
| 194 | steps: |
| 195 | - uses: actions/checkout@v6 |
| 196 | |
| 197 | - uses: dtolnay/rust-toolchain@stable |
| 198 | |
| 199 | - uses: Swatinem/rust-cache@v2 |
| 200 | with: |
| 201 | key: build |
| 202 | |
| 203 | # scripts/build-macos.sh builds the aarch64-apple-darwin binary and wraps |
| 204 | # it in a .app with the icon (README "Quick start"); it needs Xcode CLT only. |
| 205 | - name: Build |
| 206 | run: scripts/build-macos.sh crates/app teams |
| 207 | |
| 208 | - uses: actions/upload-artifact@v7 |
| 209 | with: |
| 210 | name: teams-macos |
| 211 | path: target/aarch64-apple-darwin/release/teams-macos.zip |
| 212 | |
| 213 | release: |
| 214 | name: Release |
| 215 | needs: [linux, windows, windows-arm, macos] |
| 216 | # A failed platform must not hide the artifacts the other jobs already uploaded. |
| 217 | # The job stays red afterwards when an expected asset is missing. |
| 218 | if: always() && !cancelled() && startsWith(github.ref, 'refs/tags/v') |
| 219 | runs-on: ubuntu-latest |
| 220 | permissions: |
| 221 | contents: write |
| 222 | steps: |
| 223 | # Full history and tags for the release notes. |
| 224 | - uses: actions/checkout@v6 |
| 225 | with: |
| 226 | fetch-depth: 0 |
| 227 | |
| 228 | - uses: actions/download-artifact@v8 |
| 229 | with: |
| 230 | path: dist |
| 231 | |
| 232 | # Highlights from the body of the chore(release) commit, then git-cliff's list |
| 233 | # of every feat and fix since the previous release (cliff.toml). |
| 234 | - name: Release notes |
| 235 | env: |
| 236 | TAG: ${{ github.ref_name }} |
| 237 | GITHUB_TOKEN: ${{ github.token }} |
| 238 | GIT_CLIFF_VERSION: 2.14.2 |
| 239 | GIT_CLIFF_SHA256: 24f397c733add5390fdceee3a2088588ab0d5f944ce00d34cb7029b888cf2db4 |
| 240 | run: | |
| 241 | set -euo pipefail |
| 242 | archive="git-cliff-$GIT_CLIFF_VERSION-x86_64-unknown-linux-gnu.tar.gz" |
| 243 | curl -fsSL -o "$RUNNER_TEMP/$archive" \ |
| 244 | "https://github.com/orhun/git-cliff/releases/download/v$GIT_CLIFF_VERSION/$archive" && |
| 245 | echo "$GIT_CLIFF_SHA256 $RUNNER_TEMP/$archive" | sha256sum -c - && |
| 246 | tar -xzf "$RUNNER_TEMP/$archive" -C "$RUNNER_TEMP" || true |
| 247 | cliff="$RUNNER_TEMP/git-cliff-$GIT_CLIFF_VERSION/git-cliff" |
| 248 | highlights="$(git log -1 --format=%b "$TAG" | grep -v -e '^Co-Authored-By:' -e 'Workspace version' | sed '/./,$!d' || true)" |
| 249 | # Notes must never block publishing the assets. |
| 250 | if ! { |
| 251 | # cliff.toml's tag_pattern skips nightly tags: a nightly lists everything since the last release. |
| 252 | if [[ "$TAG" == *-nightly.* ]]; then |
| 253 | printf 'Nightly build of main at %s. Not a release.\n\n' "$(git rev-parse --short "$TAG")" |
| 254 | "$cliff" --config cliff.toml --unreleased --strip all |
| 255 | elif [[ -n "${highlights//[[:space:]]/}" ]]; then |
| 256 | printf '## Highlights\n\n%s\n\n<details>\n<summary>All changes</summary>\n\n' "$highlights" |
| 257 | "$cliff" --config cliff.toml --current --strip all |
| 258 | printf '\n</details>\n' |
| 259 | else |
| 260 | "$cliff" --config cliff.toml --current --strip all |
| 261 | fi |
| 262 | } > "$RUNNER_TEMP/notes.md"; then |
| 263 | echo "Release notes could not be generated, see the commits since the previous tag." > "$RUNNER_TEMP/notes.md" |
| 264 | fi |
| 265 | cat "$RUNNER_TEMP/notes.md" |
| 266 | |
| 267 | # Artifacts drop the executable bit, the tarball restores it. |
| 268 | # Asset names use the version without the leading v (rusty-teams-0.5.0-…). |
| 269 | - name: Package |
| 270 | id: package |
| 271 | env: |
| 272 | TAG: ${{ github.ref_name }} |
| 273 | run: | |
| 274 | set -euo pipefail |
| 275 | ver="${TAG#v}" |
| 276 | mkdir release |
| 277 | missing=() |
| 278 | take() { |
| 279 | local src="$1" dest="$2" label="$3" |
| 280 | if [[ -f "$src" ]]; then |
| 281 | cp "$src" "$dest" |
| 282 | else |
| 283 | echo "missing $label" >&2 |
| 284 | missing+=("$label") |
| 285 | fi |
| 286 | } |
| 287 | if [[ -f dist/teams-linux-amd64/teams ]]; then |
| 288 | chmod +x dist/teams-linux-amd64/teams |
| 289 | tar -czf "release/rusty-teams-$ver-linux-amd64.tar.gz" -C dist/teams-linux-amd64 teams |
| 290 | # The bare binary is what the Linux self-update downloads (release_feed.rs). |
| 291 | cp dist/teams-linux-amd64/teams "release/rusty-teams-$ver-linux-amd64" |
| 292 | else |
| 293 | missing+=("linux-amd64") |
| 294 | fi |
| 295 | take dist/teams-windows-amd64/teams.exe "release/rusty-teams-$ver-windows-amd64.exe" "windows-amd64" |
| 296 | take dist/teams-windows-arm64/teams.exe "release/rusty-teams-$ver-windows-arm64.exe" "windows-arm64" |
| 297 | take dist/teams-macos/teams-macos.zip "release/rusty-teams-$ver-macos-arm64.zip" "macos" |
| 298 | shopt -s nullglob |
| 299 | packages=(dist/teams-linux-packages/*) |
| 300 | if (( ${#packages[@]} )); then |
| 301 | # deb, rpm, AppImage and its .zsync. The AppImage update information looks for that .zsync name. |
| 302 | cp "${packages[@]}" release/ |
| 303 | else |
| 304 | missing+=("linux-packages") |
| 305 | fi |
| 306 | flatpaks=(dist/teams-linux-flatpak/*.flatpak) |
| 307 | if (( ${#flatpaks[@]} )); then |
| 308 | cp "${flatpaks[@]}" release/ |
| 309 | else |
| 310 | missing+=("flatpak") |
| 311 | fi |
| 312 | archpkgs=(dist/teams-linux-arch/*.pkg.tar.zst) |
| 313 | if (( ${#archpkgs[@]} )); then |
| 314 | cp "${archpkgs[@]}" release/ |
| 315 | else |
| 316 | missing+=("arch") |
| 317 | fi |
| 318 | assets=(release/*) |
| 319 | if (( ${#assets[@]} )); then |
| 320 | echo "publish=true" >> "$GITHUB_OUTPUT" |
| 321 | else |
| 322 | echo "publish=false" >> "$GITHUB_OUTPUT" |
| 323 | fi |
| 324 | if (( ${#missing[@]} )); then |
| 325 | echo "complete=false" >> "$GITHUB_OUTPUT" |
| 326 | echo "missing=${missing[*]}" >> "$GITHUB_OUTPUT" |
| 327 | else |
| 328 | echo "complete=true" >> "$GITHUB_OUTPUT" |
| 329 | echo "missing=" >> "$GITHUB_OUTPUT" |
| 330 | fi |
| 331 | |
| 332 | - uses: softprops/action-gh-release@v3 |
| 333 | if: steps.package.outputs.publish == 'true' |
| 334 | with: |
| 335 | files: release/* |
| 336 | body_path: ${{ runner.temp }}/notes.md |
| 337 | prerelease: ${{ contains(github.ref_name, '-') }} |
| 338 | |
| 339 | - name: Fail when an asset is missing |
| 340 | if: always() && !cancelled() && steps.package.outputs.complete != 'true' |
| 341 | run: | |
| 342 | echo "Published the assets that were built. Still missing: ${{ steps.package.outputs.missing }}" |
| 343 | exit 1 |