Use a Docker build env #159
Workflow file for this run
This file contains 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: Build Ghostty | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
inputs: | |
release_version: | |
description: The version to release. | |
type: string | |
required: true | |
permissions: | |
contents: write | |
jobs: | |
build-ghostty: | |
name: Build Ghostty | |
strategy: | |
matrix: | |
ubuntu_version: ["22.04", "24.04", "24.10"] | |
runs-on: ubuntu-latest | |
steps: | |
# See the docs: https://github.com/docker/build-push-action | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
# This action checks out the source as part of the action and can therefore | |
# go before the checkout step. | |
- name: Build Docker Image | |
uses: docker/build-push-action@v6 | |
with: | |
tags: ghostty-ubuntu:${{ matrix.ubuntu_version }} | |
platforms: linux/${{ matrix.arch }} | |
build-args: | | |
UBUNTU_VERSION=${{ matrix.ubuntu_version }} | |
push: false | |
load: true | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Checkout ghostty-ubuntu | |
uses: actions/checkout@v4 | |
- name: Build Ghostty | |
run: docker run --rm -v$PWD:/workspace -w /workspace ghostty-ubuntu:${{ matrix.ubuntu_version }} /bin/bash build-ghostty.sh | |
- name: Lint .deb Package | |
# Lintian shouldn't fail our build yet | |
run: docker run --rm -v$PWD:/workspace -w /workspace ghostty-ubuntu:${{ matrix.ubuntu_version }} lintian ghostty_*.deb || true | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: package-${{ matrix.ubuntu_version }} | |
retention-days: 7 | |
path: ghostty_*.deb | |
release-ghostty: | |
name: (Pre-)Release Ghostty | |
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
needs: build-ghostty | |
steps: | |
- name: Download All Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: package-* | |
merge-multiple: true | |
- name: Validate Release Version | |
run: | | |
if ls *${{ inputs.release_version }}* 1> /dev/null 2>&1; then | |
# Version is correct. | |
# The git tag shouldn't have `~` | |
echo "RELEASE_TAG=$(echo '${{ inputs.release_version }}' | sed 's/~/-/g')" >> $GITHUB_ENV | |
else | |
echo "::error::Release version does not match filenames." | |
exit 1 | |
fi | |
- name: Publish Release Draft | |
uses: softprops/action-gh-release@v2 | |
with: | |
draft: true | |
files: ghostty_*.deb | |
name: ${{ inputs.release_version }} | |
tag_name: ${{ env.RELEASE_TAG }} | |
fail_on_unmatched_files: true |