name: Release # Build native installers and portable archives for Windows / Linux / macOS. # - Push a tag like `v0.2.3` -> builds all platforms and attaches the archives # to a GitHub Release. # - Push a `build/**` branch -> builds preview installers as workflow artifacts. # - Run manually (workflow_dispatch) -> builds all platforms by default, or only # the selected target, and uploads them as downloadable workflow artifacts. on: push: branches: ["build/**"] tags: ["v*"] workflow_dispatch: inputs: platform: description: "Build target" required: true type: choice default: all options: - all - windows-x64 - macos-arm64 permissions: contents: write # needed to create / update the GitHub Release jobs: build: if: >- github.ref != 'refs/heads/build/windows-x64' && github.ref != 'refs/heads/build/macos-arm64' && (github.event_name != 'workflow_dispatch' || inputs.platform == 'all') name: ${{ matrix.name }} runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: include: - os: windows-2022 target: x86_64-pc-windows-msvc name: windows-x64 kind: windows arch: x64 bin: ashell.exe - os: windows-2022 target: i686-pc-windows-msvc name: windows-x86 kind: windows arch: x86 bin: ashell.exe - os: windows-2022 target: aarch64-pc-windows-msvc name: windows-arm64 kind: windows arch: arm64 bin: ashell.exe - os: ubuntu-22.04 # build on the oldest supported runner for broader glibc compatibility target: x86_64-unknown-linux-gnu name: linux-x64 kind: linux arch: x64 bin: ashell - os: macos-14 # Apple Silicon target: aarch64-apple-darwin name: macos-arm64 kind: macos arch: arm64 binary_arch: arm64 bin: ashell - os: macos-14 # Intel (cross-compiled from Apple Silicon to avoid queue delays) target: x86_64-apple-darwin name: macos-x64 kind: macos arch: x64 binary_arch: x86_64 bin: ashell steps: - uses: actions/checkout@v4 # GPUI needs these system libs on Linux to compile. - name: Install Linux GUI dependencies if: runner.os == 'Linux' run: | sudo apt-get update sudo apt-get install -y --no-install-recommends \ build-essential pkg-config cmake \ libfontconfig1-dev libfreetype6-dev \ libxcb1-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev \ libxkbcommon-dev libxkbcommon-x11-dev libwayland-dev \ libgl1-mesa-dev libegl1-mesa-dev libgtk-3-dev \ libudev-dev - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable with: targets: ${{ matrix.target }} - name: Cache cargo build uses: Swatinem/rust-cache@v2 with: key: ${{ matrix.target }} - name: Build (release) run: cargo build --release --target ${{ matrix.target }} - name: Set package metadata shell: bash run: | set -euo pipefail VERSION="$(sed -n 's/^version = "\([^"]*\)"/\1/p' Cargo.toml | head -n 1)" if [ -z "$VERSION" ]; then echo "Unable to read the package version from Cargo.toml" >&2 exit 1 fi if [ "$GITHUB_REF_TYPE" = "tag" ]; then PACKAGE_VERSION="${GITHUB_REF_NAME#v}" if [ "$PACKAGE_VERSION" != "$VERSION" ]; then echo "Tag version $PACKAGE_VERSION does not match Cargo.toml version $VERSION" >&2 exit 1 fi else PACKAGE_VERSION="${VERSION}-dev.${GITHUB_SHA:0:7}" fi echo "VERSION=$VERSION" >> "$GITHUB_ENV" echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> "$GITHUB_ENV" echo "PACKAGE_BASENAME=ashell-v${PACKAGE_VERSION}-${{ matrix.name }}" >> "$GITHUB_ENV" - name: Package macOS app, DMG, and portable archive if: matrix.kind == 'macos' shell: bash run: | set -euo pipefail APP_ROOT="$RUNNER_TEMP/${PACKAGE_BASENAME}-app" DMG_ROOT="$RUNNER_TEMP/${PACKAGE_BASENAME}-dmg" APP="$APP_ROOT/ashell.app" CONTENTS="$APP/Contents" mkdir -p "$CONTENTS/MacOS" "$CONTENTS/Resources" "$DMG_ROOT" dist cp "target/${{ matrix.target }}/release/ashell" "$CONTENTS/MacOS/ashell" chmod 755 "$CONTENTS/MacOS/ashell" cp "assets/icons/ashell.icns" "$CONTENTS/Resources/ashell.icns" cat > "$CONTENTS/Info.plist" < CFBundleDevelopmentRegion en CFBundleExecutable ashell CFBundleIconFile ashell.icns CFBundleIdentifier dev.ashell.app CFBundleInfoDictionaryVersion 6.0 CFBundleName ashell CFBundlePackageType APPL CFBundleShortVersionString ${VERSION} CFBundleVersion ${GITHUB_RUN_NUMBER} LSMinimumSystemVersion 12.0 NSHighResolutionCapable EOF printf 'APPL????' > "$CONTENTS/PkgInfo" plutil -lint "$CONTENTS/Info.plist" # Release builds remain ad-hoc signed until signing credentials are configured. codesign --force --deep --sign - "$APP" codesign --verify --deep --strict --verbose=2 "$APP" ditto -c -k --sequesterRsrc --keepParent \ "$APP" "dist/${PACKAGE_BASENAME}-portable.zip" ditto "$APP" "$DMG_ROOT/ashell.app" ln -s /Applications "$DMG_ROOT/Applications" hdiutil create \ -volname "ashell ${VERSION}" \ -srcfolder "$DMG_ROOT" \ -ov \ -format UDZO \ "dist/${PACKAGE_BASENAME}.dmg" EXPECTED_ARCH="${{ matrix.binary_arch }}" ACTUAL_ARCHS="$(lipo -archs "$CONTENTS/MacOS/ashell")" if [ "$ACTUAL_ARCHS" != "$EXPECTED_ARCH" ]; then echo "Expected $EXPECTED_ARCH binary, found $ACTUAL_ARCHS" >&2 exit 1 fi shasum -a 256 dist/* - name: Package Windows installer and portable archive if: matrix.kind == 'windows' shell: pwsh env: ASHELL_ARCH: ${{ matrix.arch }} ASHELL_BINARY_PATH: ${{ github.workspace }}\target\${{ matrix.target }}\release\ashell.exe ASHELL_OUTPUT_DIR: ${{ github.workspace }}\dist run: | $ErrorActionPreference = "Stop" New-Item -ItemType Directory -Path "dist" -Force | Out-Null $isccCommand = Get-Command "ISCC.exe" -ErrorAction SilentlyContinue if ($null -ne $isccCommand) { $iscc = $isccCommand.Source } else { $iscc = "${env:ProgramFiles(x86)}\Inno Setup 6\ISCC.exe" } if (-not (Test-Path $iscc)) { throw "Inno Setup compiler was not found" } & $iscc "packaging\windows\ashell.iss" if ($LASTEXITCODE -ne 0) { throw "Inno Setup failed with exit code $LASTEXITCODE" } $installer = "dist\${env:PACKAGE_BASENAME}-setup.exe" if (-not (Test-Path $installer)) { throw "Expected installer was not created: $installer" } $stage = Join-Path $env:RUNNER_TEMP $env:PACKAGE_BASENAME New-Item -ItemType Directory -Path $stage | Out-Null Copy-Item $env:ASHELL_BINARY_PATH (Join-Path $stage "ashell.exe") Compress-Archive -Path $stage -DestinationPath "dist\${env:PACKAGE_BASENAME}-portable.zip" Get-FileHash -Algorithm SHA256 "dist\*" - name: Package Linux portable archive if: matrix.kind == 'linux' shell: bash run: | set -euo pipefail STAGE="$RUNNER_TEMP/$PACKAGE_BASENAME" mkdir -p "$STAGE" dist cp "target/${{ matrix.target }}/release/${{ matrix.bin }}" "$STAGE/" tar -C "$RUNNER_TEMP" -czf "dist/${PACKAGE_BASENAME}.tar.gz" "$PACKAGE_BASENAME" sha256sum dist/* - name: Upload workflow artifact uses: actions/upload-artifact@v4 with: name: ${{ matrix.name }} path: dist/* if-no-files-found: error retention-days: 14 build-windows-x64: if: >- github.ref == 'refs/heads/build/windows-x64' || (github.event_name == 'workflow_dispatch' && inputs.platform == 'windows-x64') name: windows-x64 runs-on: windows-2022 steps: - uses: actions/checkout@v4 - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable with: targets: x86_64-pc-windows-msvc - name: Cache cargo build uses: Swatinem/rust-cache@v2 with: key: x86_64-pc-windows-msvc - name: Build (release) run: cargo build --release --target x86_64-pc-windows-msvc - name: Set package metadata shell: bash run: | set -euo pipefail VERSION="$(sed -n 's/^version = "\([^\"]*\)"/\1/p' Cargo.toml | head -n 1)" if [ -z "$VERSION" ]; then echo "Unable to read the package version from Cargo.toml" >&2 exit 1 fi PACKAGE_VERSION="${VERSION}-dev.${GITHUB_SHA:0:7}" echo "VERSION=$VERSION" >> "$GITHUB_ENV" echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> "$GITHUB_ENV" echo "PACKAGE_BASENAME=ashell-v${PACKAGE_VERSION}-windows-x64" >> "$GITHUB_ENV" - name: Package Windows installer and portable archive shell: pwsh env: ASHELL_ARCH: x64 ASHELL_BINARY_PATH: ${{ github.workspace }}\target\x86_64-pc-windows-msvc\release\ashell.exe ASHELL_OUTPUT_DIR: ${{ github.workspace }}\dist run: | $ErrorActionPreference = "Stop" New-Item -ItemType Directory -Path "dist" -Force | Out-Null $isccCommand = Get-Command "ISCC.exe" -ErrorAction SilentlyContinue if ($null -ne $isccCommand) { $iscc = $isccCommand.Source } else { $iscc = "${env:ProgramFiles(x86)}\Inno Setup 6\ISCC.exe" } if (-not (Test-Path $iscc)) { throw "Inno Setup compiler was not found" } & $iscc "packaging\windows\ashell.iss" if ($LASTEXITCODE -ne 0) { throw "Inno Setup failed with exit code $LASTEXITCODE" } $installer = "dist\${env:PACKAGE_BASENAME}-setup.exe" if (-not (Test-Path $installer)) { throw "Expected installer was not created: $installer" } $stage = Join-Path $env:RUNNER_TEMP $env:PACKAGE_BASENAME New-Item -ItemType Directory -Path $stage | Out-Null Copy-Item $env:ASHELL_BINARY_PATH (Join-Path $stage "ashell.exe") Compress-Archive -Path $stage -DestinationPath "dist\${env:PACKAGE_BASENAME}-portable.zip" Get-FileHash -Algorithm SHA256 "dist\*" - name: Upload workflow artifact uses: actions/upload-artifact@v4 with: name: windows-x64 path: dist/* if-no-files-found: error retention-days: 14 build-macos-arm64: if: >- github.ref == 'refs/heads/build/macos-arm64' || (github.event_name == 'workflow_dispatch' && inputs.platform == 'macos-arm64') name: macos-arm64 runs-on: macos-14 steps: - uses: actions/checkout@v4 - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable with: targets: aarch64-apple-darwin - name: Cache cargo build uses: Swatinem/rust-cache@v2 with: key: aarch64-apple-darwin - name: Build (release) run: cargo build --release --target aarch64-apple-darwin - name: Set package metadata shell: bash run: | set -euo pipefail VERSION="$(sed -n 's/^version = "\([^"]*\)"/\1/p' Cargo.toml | head -n 1)" if [ -z "$VERSION" ]; then echo "Unable to read the package version from Cargo.toml" >&2 exit 1 fi PACKAGE_VERSION="${VERSION}-dev.${GITHUB_SHA:0:7}" echo "VERSION=$VERSION" >> "$GITHUB_ENV" echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> "$GITHUB_ENV" echo "PACKAGE_BASENAME=ashell-v${PACKAGE_VERSION}-macos-arm64" >> "$GITHUB_ENV" - name: Package macOS app, DMG, and portable archive shell: bash run: | set -euo pipefail APP_ROOT="$RUNNER_TEMP/${PACKAGE_BASENAME}-app" DMG_ROOT="$RUNNER_TEMP/${PACKAGE_BASENAME}-dmg" APP="$APP_ROOT/ashell.app" CONTENTS="$APP/Contents" mkdir -p "$CONTENTS/MacOS" "$CONTENTS/Resources" "$DMG_ROOT" dist cp "target/aarch64-apple-darwin/release/ashell" "$CONTENTS/MacOS/ashell" chmod 755 "$CONTENTS/MacOS/ashell" cp "assets/icons/ashell.icns" "$CONTENTS/Resources/ashell.icns" cat > "$CONTENTS/Info.plist" < CFBundleDevelopmentRegion en CFBundleExecutable ashell CFBundleIconFile ashell.icns CFBundleIdentifier dev.ashell.app CFBundleInfoDictionaryVersion 6.0 CFBundleName ashell CFBundlePackageType APPL CFBundleShortVersionString ${VERSION} CFBundleVersion ${GITHUB_RUN_NUMBER} LSMinimumSystemVersion 12.0 NSHighResolutionCapable EOF printf 'APPL????' > "$CONTENTS/PkgInfo" plutil -lint "$CONTENTS/Info.plist" codesign --force --deep --sign - "$APP" codesign --verify --deep --strict --verbose=2 "$APP" ditto -c -k --sequesterRsrc --keepParent \ "$APP" "dist/${PACKAGE_BASENAME}-portable.zip" ditto "$APP" "$DMG_ROOT/ashell.app" ln -s /Applications "$DMG_ROOT/Applications" hdiutil create \ -volname "ashell ${VERSION}" \ -srcfolder "$DMG_ROOT" \ -ov \ -format UDZO \ "dist/${PACKAGE_BASENAME}.dmg" EXPECTED_ARCH="arm64" ACTUAL_ARCHS="$(lipo -archs "$CONTENTS/MacOS/ashell")" if [ "$ACTUAL_ARCHS" != "$EXPECTED_ARCH" ]; then echo "Expected $EXPECTED_ARCH binary, found $ACTUAL_ARCHS" >&2 exit 1 fi shasum -a 256 dist/* - name: Upload workflow artifact uses: actions/upload-artifact@v4 with: name: macos-arm64 path: dist/* if-no-files-found: error retention-days: 14 publish: name: Publish Release needs: build if: startsWith(github.ref, 'refs/tags/') runs-on: ubuntu-latest steps: - name: Download all workflow artifacts uses: actions/download-artifact@v4 with: path: dist merge-multiple: true - name: Attach to GitHub Release uses: softprops/action-gh-release@v2 with: files: dist/* generate_release_notes: true fail_on_unmatched_files: true cask: name: Update Homebrew Cask needs: publish if: startsWith(github.ref, 'refs/tags/') runs-on: ubuntu-latest steps: - name: Checkout Homebrew Tap uses: actions/checkout@v4 with: repository: rust-kotlin/homebrew-taps token: ${{ secrets.TAP_GITHUB_TOKEN }} path: tap - name: Download all macOS artifacts uses: actions/download-artifact@v4 with: pattern: macos-* path: dist merge-multiple: true - name: Update Cask run: | VERSION=${GITHUB_REF#refs/tags/v} SHA_ARM=$(sha256sum "dist/ashell-v${VERSION}-macos-arm64.dmg" | cut -d' ' -f1) SHA_INTEL=$(sha256sum "dist/ashell-v${VERSION}-macos-x64.dmg" | cut -d' ' -f1) mkdir -p tap/Casks CASK_FILE="tap/Casks/ashell.rb" cat > "$CASK_FILE" <