Skip to content

chore(release): v0.3.31 #12

chore(release): v0.3.31

chore(release): v0.3.31 #12

Workflow file for this run

name: Release
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
tag:
description: Existing release tag to publish
required: true
type: string
permissions:
contents: write
jobs:
release:
runs-on: macos-26
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref }}
- name: Parse version from tag
id: version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
TAG="${{ inputs.tag }}"
else
TAG="${GITHUB_REF#refs/tags/}"
fi
case "$TAG" in
v*)
;;
*)
echo "::error::Expected tag in the form v<version>, got: $TAG"
exit 1
;;
esac
VERSION="${TAG#v}"
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Build release app
run: |
xcodebuild \
-project v2s.xcodeproj \
-scheme v2s \
-configuration Release \
-derivedDataPath .build/release \
build
- name: Package app
id: package
run: |
APP_PATH=".build/release/Build/Products/Release/v2s.app"
ZIP_PATH="dist/v2s-${{ steps.version.outputs.version }}.app.zip"
CHECKSUM_PATH="dist/v2s-${{ steps.version.outputs.version }}.sha256"
mkdir -p dist
ditto -c -k --keepParent "$APP_PATH" "$ZIP_PATH"
(cd dist && shasum -a 256 "$(basename "$ZIP_PATH")" > "$(basename "$CHECKSUM_PATH")")
echo "zip=$ZIP_PATH" >> "$GITHUB_OUTPUT"
echo "checksum=$CHECKSUM_PATH" >> "$GITHUB_OUTPUT"
- name: Generate appcast
run: |
# Find Sparkle bin directory from SPM build artifacts
SPARKLE_BIN=""
for candidate in \
"$(find .build -name generate_appcast -type f 2>/dev/null | head -1)"; do
if [ -n "$candidate" ] && [ -f "$candidate" ]; then
SPARKLE_BIN="$(dirname "$candidate")"
break
fi
done
if [ -z "$SPARKLE_BIN" ]; then
echo "::error::Could not find generate_appcast in .build artifacts"
exit 1
fi
echo "Sparkle bin: $SPARKLE_BIN"
# Write EdDSA private key to a temporary file
KEY_FILE="$(mktemp)"
echo "${{ secrets.SPARKLE_PRIVATE_KEY }}" > "$KEY_FILE"
# Download previous appcast if it exists, so generate_appcast can append
curl -fsSL \
"https://github.com/${{ github.repository }}/releases/latest/download/appcast.xml" \
-o dist/appcast.xml 2>/dev/null || true
"$SPARKLE_BIN/generate_appcast" \
--ed-key-file "$KEY_FILE" \
--download-url-prefix "https://github.com/${{ github.repository }}/releases/download/${{ steps.version.outputs.tag }}/" \
--link "https://github.com/${{ github.repository }}" \
dist/
rm -f "$KEY_FILE"
- name: Create or update GitHub release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG="${{ steps.version.outputs.tag }}"
if gh release view "$TAG" >/dev/null 2>&1; then
gh release upload "$TAG" \
"${{ steps.package.outputs.zip }}" \
"${{ steps.package.outputs.checksum }}" \
dist/appcast.xml \
--clobber
else
gh release create "$TAG" \
"${{ steps.package.outputs.zip }}" \
"${{ steps.package.outputs.checksum }}" \
dist/appcast.xml \
--title "$TAG" \
--generate-notes \
--verify-tag
fi