v0.1.60 #57
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: | |
| release: | |
| types: [published] | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: release-${{ github.event.release.id }} | |
| cancel-in-progress: false | |
| env: | |
| VERSION: ${{ github.event.release.tag_name }} | |
| jobs: | |
| build-dmg: | |
| name: Build ${{ matrix.arch }} DMG | |
| runs-on: ${{ matrix.runner }} | |
| timeout-minutes: 45 | |
| permissions: | |
| contents: read | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - arch: arm64 | |
| target: aarch64-apple-darwin | |
| runner: macos-26 | |
| - arch: x86_64 | |
| target: x86_64-apple-darwin | |
| runner: macos-26 | |
| env: | |
| VERSION: ${{ github.event.release.tag_name }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Cache Rust | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Install cargo-bundle | |
| run: cargo install cargo-bundle --locked | |
| - name: Build DMG | |
| run: ./scripts/build-dmg.sh --version "$VERSION" --arch "${{ matrix.arch }}" --target "${{ matrix.target }}" --no-layout | |
| - name: Upload DMG artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: termy-dmg-${{ matrix.arch }} | |
| path: target/release/Termy-${{ env.VERSION }}-macos-${{ matrix.arch }}.dmg | |
| if-no-files-found: error | |
| build-windows-setup: | |
| name: Build Windows x64 Setup | |
| runs-on: windows-latest | |
| timeout-minutes: 45 | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: x86_64-pc-windows-msvc | |
| - name: Cache Rust | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Install Inno Setup | |
| run: choco install innosetup --no-progress -y | |
| - name: Build Setup.exe | |
| shell: pwsh | |
| run: .\scripts\build-setup.ps1 -Version "${env:VERSION}" -Arch x64 -Target x86_64-pc-windows-msvc | |
| - name: Upload Setup artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: termy-setup-x64 | |
| path: target/dist/Termy-${{ env.VERSION }}-x64-Setup.exe | |
| if-no-files-found: error | |
| build-linux: | |
| name: Build Linux ${{ matrix.arch }} | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 45 | |
| permissions: | |
| contents: read | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - arch: x86_64 | |
| target: x86_64-unknown-linux-gnu | |
| env: | |
| VERSION: ${{ github.event.release.tag_name }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install Linux dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| build-essential \ | |
| cmake \ | |
| clang \ | |
| libfontconfig-dev \ | |
| libwayland-dev \ | |
| libx11-xcb-dev \ | |
| libxkbcommon-x11-dev \ | |
| libssl-dev \ | |
| libzstd-dev \ | |
| libasound2-dev \ | |
| libvulkan1 | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Cache Rust | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Build Linux tarball | |
| run: ./scripts/build-linux.sh --version "$VERSION" --arch "${{ matrix.arch }}" --target "${{ matrix.target }}" | |
| - name: Install appimagetool | |
| run: | | |
| curl -fsSL -o /tmp/appimagetool.AppImage \ | |
| https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-${{ matrix.arch }}.AppImage | |
| chmod +x /tmp/appimagetool.AppImage | |
| echo "APPIMAGETOOL=/tmp/appimagetool.AppImage" >> "$GITHUB_ENV" | |
| - name: Build Linux AppImage | |
| run: APPIMAGETOOL="$APPIMAGETOOL" ./scripts/build-linux.sh --version "$VERSION" --arch "${{ matrix.arch }}" --target "${{ matrix.target }}" --format appimage | |
| - name: Upload Linux tarball artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: termy-linux-tarball-${{ matrix.arch }} | |
| path: target/dist/Termy-${{ env.VERSION }}-linux-${{ matrix.arch }}.tar.gz | |
| if-no-files-found: error | |
| - name: Upload Linux AppImage artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: termy-linux-appimage-${{ matrix.arch }} | |
| path: target/dist/Termy-${{ env.VERSION }}-linux-${{ matrix.arch }}.AppImage | |
| if-no-files-found: error | |
| attach-and-finalize-release: | |
| name: Attach artifacts and finalize release | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| needs: | |
| - build-dmg | |
| - build-windows-setup | |
| - build-linux | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| merge-multiple: true | |
| - name: Attach artifacts to release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ github.event.release.tag_name }} | |
| files: | | |
| dist/*.dmg | |
| dist/*.exe | |
| dist/*.tar.gz | |
| dist/*.AppImage | |
| fail_on_unmatched_files: true | |
| overwrite_files: true | |
| - name: Mark release as latest and not pre-release | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| await github.request("PATCH /repos/{owner}/{repo}/releases/{release_id}", { | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| release_id: context.payload.release.id, | |
| prerelease: false, | |
| make_latest: "true" | |
| }); | |
| update-homebrew-cask: | |
| name: Update Homebrew cask and open PR | |
| runs-on: macos-latest | |
| timeout-minutes: 15 | |
| needs: | |
| - attach-and-finalize-release | |
| if: ${{ !github.event.release.prerelease }} | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - name: Checkout default branch | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.repository.default_branch }} | |
| - name: Read release metadata | |
| id: release | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const { owner, repo } = context.repo; | |
| const release_id = context.payload.release.id; | |
| const response = await github.rest.repos.getRelease({ owner, repo, release_id }); | |
| const release = response.data; | |
| const tag = release.tag_name; | |
| const version = tag.replace(/^v/, ""); | |
| const assets = release.assets || []; | |
| const armName = `Termy-${tag}-macos-arm64.dmg`; | |
| const intelName = `Termy-${tag}-macos-x86_64.dmg`; | |
| const armAsset = assets.find((asset) => asset.name === armName); | |
| const intelAsset = assets.find((asset) => asset.name === intelName); | |
| if (!armAsset || !intelAsset) { | |
| core.setFailed( | |
| `Missing DMG assets for ${tag}. Expected: ${armName}, ${intelName}. Found: ${assets.map((asset) => asset.name).join(", ")}` | |
| ); | |
| return; | |
| } | |
| core.setOutput("tag", tag); | |
| core.setOutput("version", version); | |
| core.setOutput("arm_url", armAsset.browser_download_url); | |
| core.setOutput("intel_url", intelAsset.browser_download_url); | |
| - name: Download release DMGs | |
| run: | | |
| curl -fsSL -o /tmp/termy-arm64.dmg "${{ steps.release.outputs.arm_url }}" | |
| curl -fsSL -o /tmp/termy-x86_64.dmg "${{ steps.release.outputs.intel_url }}" | |
| - name: Compute checksums | |
| id: checksums | |
| run: | | |
| echo "arm_sha=$(shasum -a 256 /tmp/termy-arm64.dmg | awk '{print $1}')" >> "$GITHUB_OUTPUT" | |
| echo "intel_sha=$(shasum -a 256 /tmp/termy-x86_64.dmg | awk '{print $1}')" >> "$GITHUB_OUTPUT" | |
| - name: Update cask file | |
| env: | |
| VERSION: ${{ steps.release.outputs.version }} | |
| ARM_SHA: ${{ steps.checksums.outputs.arm_sha }} | |
| INTEL_SHA: ${{ steps.checksums.outputs.intel_sha }} | |
| run: | | |
| perl -i -pe 's|^ version ".*"$| version "$ENV{VERSION}"|' Casks/termy.rb | |
| perl -0777 -i -pe 's| sha256 arm:\s*"[^"]+",\n\s*intel:\s*"[^"]+"| sha256 arm: "$ENV{ARM_SHA}",\n intel: "$ENV{INTEL_SHA}"|' Casks/termy.rb | |
| - name: Open cask update PR | |
| uses: peter-evans/create-pull-request@v8 | |
| with: | |
| branch: automation/homebrew-cask-${{ steps.release.outputs.version }} | |
| delete-branch: true | |
| commit-message: "chore(cask): update termy cask for ${{ steps.release.outputs.tag }}" | |
| title: "chore(cask): update Homebrew cask for ${{ steps.release.outputs.tag }}" | |
| body: | | |
| Automated cask update for `${{ steps.release.outputs.tag }}`. | |
| - Updated `Casks/termy.rb` version to `${{ steps.release.outputs.version }}` | |
| - Updated macOS DMG checksums: | |
| - arm64: `${{ steps.checksums.outputs.arm_sha }}` | |
| - x86_64: `${{ steps.checksums.outputs.intel_sha }}` | |
| Generated by the release workflow after assets were attached. |