WIP CI Release Script (#3034)

This commit is contained in:
Mitchell Hashimoto
2024-12-20 09:58:15 -08:00
committed by GitHub
2 changed files with 87 additions and 1 deletions

81
.github/workflows/release-tag.yml vendored Normal file
View File

@ -0,0 +1,81 @@
on:
workflow_dispatch:
inputs:
version:
description: "Version to deploy (format: vX.Y.Z)"
required: true
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
name: Release Tag
# We must only run one release workflow at a time to prevent corrupting
# our release artifacts.
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false
jobs:
setup:
runs-on: namespace-profile-ghostty-sm
outputs:
version: ${{ steps.extract_version.outputs.version }}
steps:
- name: Validate Version Input
if: github.event_name == 'workflow_dispatch'
run: |
if [[ ! "${{ github.event.inputs.version }}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Error: Version must follow the format vX.Y.Z (e.g., v1.0.0)."
exit 1
fi
echo "Version is valid: ${{ github.event.inputs.version }}"
- name: Exract the Version
id: extract_version
run: |
if [[ "${{ github.event_name }}" == "push" ]]; then
# Remove the leading 'v' from the tag
VERSION=${GITHUB_REF#refs/tags/v}
echo "version=$VERSION" >> $GITHUB_OUTPUT
elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
VERSION=${{ github.event.inputs.version }}
VERSION=${VERSION#v}
echo "version=$VERSION" >> $GITHUB_OUTPUT
else
echo "Error: Unsupported event type."
exit 1
fi
source-tarball:
runs-on: namespace-profile-ghostty-md
needs: [setup]
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v30
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: cachix/cachix-action@v15
with:
name: ghostty
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
- name: Create Tarball
run: git archive --format=tgz -o ghostty-source.tar.gz HEAD
- name: Sign Tarball
run: |
echo -n "${{ secrets.MINISIGN_KEY }}" > minisign.key
echo -n "${{ secrets.MINISIGN_PASSWORD }}" > minisign.password
nix develop -c minisign -S -m ghostty-source.tar.gz -s minisign.key < minisign.password
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: source-tarball
path: |-
ghostty-source.tar.gz
ghostty-source.tar.gz.minisig

View File

@ -4,6 +4,7 @@ struct AboutView: View {
@Environment(\.openURL) var openURL @Environment(\.openURL) var openURL
private let githubURL = URL(string: "https://github.com/ghostty-org/ghostty") private let githubURL = URL(string: "https://github.com/ghostty-org/ghostty")
private let docsURL = URL(string: "https://ghostty.org/docs")
/// Read the commit from the bundle. /// Read the commit from the bundle.
private var build: String? { Bundle.main.infoDictionary?["CFBundleVersion"] as? String } private var build: String? { Bundle.main.infoDictionary?["CFBundleVersion"] as? String }
@ -77,12 +78,16 @@ struct AboutView: View {
.frame(maxWidth: .infinity) .frame(maxWidth: .infinity)
HStack(spacing: 8) { HStack(spacing: 8) {
if let url = docsURL {
Button("Docs") {
openURL(url)
}
}
if let url = githubURL { if let url = githubURL {
Button("GitHub") { Button("GitHub") {
openURL(url) openURL(url)
} }
} }
} }
if let copy = self.copyright { if let copy = self.copyright {