Skip to content

Version 4.3.1: Rename list-voices to sample-voices #27

Version 4.3.1: Rename list-voices to sample-voices

Version 4.3.1: Rename list-voices to sample-voices #27

Workflow file for this run

name: Build and Release
on:
push:
branches:
- main
paths:
- 'Sources/SwiftMacPackage/main.swift'
- '.github/workflows/release.yml'
permissions:
contents: write
jobs:
check-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get-version.outputs.version }}
version-changed: ${{ steps.check-tag.outputs.changed }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get version from main.swift
id: get-version
run: |
VERSION=$(grep 'let version = ' Sources/SwiftMacPackage/main.swift | sed 's/.*"\(.*\)".*/\1/')
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Found version: $VERSION"
- name: Check if version tag exists
id: check-tag
run: |
VERSION="${{ steps.get-version.outputs.version }}"
if git rev-parse "v$VERSION" >/dev/null 2>&1; then
echo "changed=false" >> $GITHUB_OUTPUT
echo "Tag v$VERSION already exists"
else
echo "changed=true" >> $GITHUB_OUTPUT
echo "Tag v$VERSION does not exist - will create release"
fi
build-and-release:
needs: check-version
if: needs.check-version.outputs.version-changed == 'true'
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Swift
uses: swift-actions/setup-swift@v2
- name: Build for Apple Silicon (arm64)
run: |
echo "Building for Apple Silicon (arm64)..."
swift build --configuration release --arch arm64
# Verify architecture
echo "Verifying swiftmac binary:"
file .build/release/swiftmac
lipo -info .build/release/swiftmac
- name: Create release archive
run: |
VERSION="${{ needs.check-version.outputs.version }}"
echo "Building swiftmac version $VERSION (Apple Silicon only)"
# Create release directory
mkdir -p swiftmac
# Copy arm64 binary and frameworks
cp .build/release/swiftmac swiftmac/
cp -rf .build/release/ogg.framework swiftmac/
cp -rf .build/release/vorbis.framework swiftmac/
# Copy support files
cp swiftmac-voices.el swiftmac/
cp cloud-swiftmac swiftmac/
cp log-swiftmac swiftmac/
# Copy documentation
cp LICENSE swiftmac/
cp Readme.org swiftmac/
cp Readme.emacspeak.org swiftmac/
# Create tarball
tar -czf swiftmac-$VERSION.tar.gz swiftmac
echo "Release archive created: swiftmac-$VERSION.tar.gz"
ls -lh swiftmac-$VERSION.tar.gz
shell: bash
- name: Generate release notes
run: |
VERSION="${{ needs.check-version.outputs.version }}"
echo "Generating release notes..."
# Get commits since last tag
LAST_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
if [ -z "$LAST_TAG" ]; then
CHANGES=$(git log --pretty=format:"- %s" -10)
else
CHANGES=$(git log --pretty=format:"- %s" ${LAST_TAG}..HEAD)
fi
# Create release notes
cat > RELEASE_NOTES.md <<'EOF'
## SwiftMac ${VERSION}
**Apple Silicon Release** (arm64)
### Requirements
- macOS with Apple Silicon (M1, M2, M3, M4, or newer)
- Emacspeak installed
### Installation
1. **Download and extract:**
\`\`\`bash
curl -L https://github.com/robertmeta/swiftmac/releases/download/v${VERSION}/swiftmac-${VERSION}.tar.gz | tar xz
cd swiftmac
\`\`\`
2. **Install to Emacspeak:**
\`\`\`bash
# Copy binary and frameworks
cp -rf swiftmac ogg.framework vorbis.framework $EMACSPEAK_DIR/servers/
# Copy support scripts
cp cloud-swiftmac log-swiftmac $EMACSPEAK_DIR/servers/
# Copy voice configuration
cp swiftmac-voices.el $EMACSPEAK_DIR/lisp/
# Update .servers file
cd $EMACSPEAK_DIR/servers
echo "swiftmac" >> .servers
echo "log-swiftmac" >> .servers
echo "cloud-swiftmac" >> .servers
sort -u .servers -o .servers
\`\`\`
3. **Configure Emacs:**
Add to your Emacs init file:
\`\`\`elisp
(setenv "EMACSPEAK_DIR" "/path/to/.emacspeak") ; Set your path
(load-file "/path/to/.emacspeak/lisp/emacspeak-setup.el")
(dtk-select-server "swiftmac")
\`\`\`
### Changes
${CHANGES}
---
For more information, see the [full documentation](https://github.com/robertmeta/swiftmac).
EOF
# Substitute VERSION variable
sed -i.bak "s/\${VERSION}/$VERSION/g" RELEASE_NOTES.md
rm RELEASE_NOTES.md.bak
echo "Release notes created"
- name: Create GitHub Release with gh CLI
run: |
VERSION="${{ needs.check-version.outputs.version }}"
echo "Creating release v$VERSION using gh CLI..."
gh release create "v$VERSION" \
"swiftmac-$VERSION.tar.gz" \
--title "SwiftMac $VERSION" \
--notes-file RELEASE_NOTES.md \
--latest
echo "✅ Release created successfully!"
echo "📦 Download: https://github.com/robertmeta/swiftmac/releases/download/v$VERSION/swiftmac-$VERSION.tar.gz"
echo "🔗 View release: https://github.com/robertmeta/swiftmac/releases/tag/v$VERSION"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update latest release symlink
run: |
VERSION="${{ needs.check-version.outputs.version }}"
echo "Released SwiftMac version $VERSION"
echo "Download: https://github.com/robertmeta/swiftmac/releases/download/v$VERSION/swiftmac-$VERSION.tar.gz"