-
Notifications
You must be signed in to change notification settings - Fork 2
198 lines (154 loc) · 5.72 KB
/
Copy pathrelease.yml
File metadata and controls
198 lines (154 loc) · 5.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
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 <<'NOTES_EOF'
## SwiftMac VERSION_PLACEHOLDER
**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/vVERSION_PLACEHOLDER/swiftmac-VERSION_PLACEHOLDER.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:
```emacs-lisp
(setenv "EMACSPEAK_DIR" "/path/to/.emacspeak") ; Set your path
(load-file "/path/to/.emacspeak/lisp/emacspeak-setup.el")
(dtk-select-server "swiftmac")
```
### Changes
CHANGES_PLACEHOLDER
---
For more information, see the [full documentation](https://github.com/robertmeta/swiftmac).
NOTES_EOF
# Substitute variables
sed -i.bak "s/VERSION_PLACEHOLDER/$VERSION/g" RELEASE_NOTES.md
sed -i.bak "s|CHANGES_PLACEHOLDER|$CHANGES|g" RELEASE_NOTES.md
rm RELEASE_NOTES.md.bak
echo "Release notes created"
cat RELEASE_NOTES.md
- 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"