GitHub Action Workflow for Release #135
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 git tag 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 | |
container: | |
image: ubuntu:${{ matrix.ubuntu_version }} | |
steps: | |
- name: Checkout ghostty-ubuntu | |
uses: actions/checkout@v4 | |
- name: Setup Build Env | |
run: ./setup-env.sh | |
- name: Build Ghostty | |
run: ./build-ghostty.sh | |
- name: Lint .deb Package | |
run: lintian ghostty_*.deb || true # Lintian shouldn't fail our build yet | |
- 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 ! head -n 1 debian/changelog | grep -q '${{ inputs.release_version }}'; then | |
echo "::error::Release version does not match changelog." | |
exit 1 | |
else | |
# The git tag shouldn't have `~` | |
echo "RELEASE_TAG=$(echo '${{ inputs.release_version }}' | sed 's/~/-/g')" >> $GITHUB_ENV | |
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 |