-
Notifications
You must be signed in to change notification settings - Fork 110
244 lines (204 loc) · 9.25 KB
/
release.yml
File metadata and controls
244 lines (204 loc) · 9.25 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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
name: Create Release
# Release workflow for Mona Sans
on:
push:
tags:
- 'v*.*' # Matches tags like v1.300, etc.
workflow_dispatch:
inputs:
version:
description: 'Version for testing (e.g., "test-1.4" or "dev-2024-01-01")'
required: true
default: 'test-1.4'
type: string
permissions:
contents: write # Required to create releases and upload assets
jobs:
build:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
tag: ${{ steps.version.outputs.tag }}
tag_name: ${{ steps.version.outputs.tag }}
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0 # Full history for proper release notes
- name: Extract version from tag or input
id: version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
VERSION="${{ github.event.inputs.version }}"
if [[ "$VERSION" == v* ]]; then
TAG="$VERSION"
else
TAG="v$VERSION"
fi
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "tag=${TAG}" >> $GITHUB_OUTPUT
else
VERSION=${GITHUB_REF#refs/tags/v}
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
fi
- name: Prepare release artifacts
run: |
mkdir -p release-artifacts
# Create static fonts package (OTF + TTF)
zip -r "release-artifacts/mona-sans-static-v${{ steps.version.outputs.version }}.zip" \
fonts/static/ OFL.txt README.md
# Create variable fonts package
zip -r "release-artifacts/mona-sans-variable-v${{ steps.version.outputs.version }}.zip" \
fonts/variable/ OFL.txt README.md
# Create webfonts package
if [ -d "fonts/webfonts" ]; then
zip -r "release-artifacts/mona-sans-webfonts-v${{ steps.version.outputs.version }}.zip" \
fonts/webfonts/ OFL.txt README.md
fi
# Create complete package with all formats
zip -r "release-artifacts/mona-sans-complete-v${{ steps.version.outputs.version }}.zip" \
fonts/ -x "fonts/googlefonts/*" -x "fonts/googlefonts/**" \
OFL.txt README.md
- name: Upload release zip artifacts
uses: actions/upload-artifact@v4
with:
name: mona-sans-release-zips-v${{ steps.version.outputs.version }}
path: release-artifacts/*.zip
include-hidden-files: false
- name: Upload font build artifacts
uses: actions/upload-artifact@v4
with:
name: mona-sans-fonts-v${{ steps.version.outputs.version }}
path: fonts/
include-hidden-files: false
build-deb:
runs-on: ubuntu-24.04
needs: [build]
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Download font artifacts
uses: actions/download-artifact@v4
with:
name: mona-sans-fonts-v${{ needs.build.outputs.version }}
path: .
- name: Extract version
id: version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
VERSION="${{ github.event.inputs.version }}"
else
VERSION=${GITHUB_REF#refs/tags/v}
fi
# Normalize to a valid Debian version: strip leading 'v', replace
# characters illegal in dpkg versions, and prefix with '0~' when the
# result doesn't start with a digit (Debian convention for pre-release)
DEB_VERSION=$(echo "$VERSION" | awk '{sub(/^v/,""); gsub(/[^A-Za-z0-9.+~-]/,"."); if ($0 !~ /^[0-9]/) $0="0~"$0; print}')
echo "version=${DEB_VERSION}" >> $GITHUB_OUTPUT
- name: Build .deb package
run: |
PKG="fonts-mona-sans"
VERSION="${{ steps.version.outputs.version }}"
DEB_DIR="${PKG}_${VERSION}_all"
# Create package directory structure
mkdir -p "${DEB_DIR}/DEBIAN"
mkdir -p "${DEB_DIR}/usr/share/fonts/truetype/mona-sans"
mkdir -p "${DEB_DIR}/usr/share/fonts/truetype/mona-sans-variable"
mkdir -p "${DEB_DIR}/usr/share/doc/${PKG}"
# Install static TTF files (Mona Sans + Mona Sans Mono)
cp fonts/static/ttf/*.ttf "${DEB_DIR}/usr/share/fonts/truetype/mona-sans/"
# Install variable TTF files (Mona Sans VF + Mona Sans Mono VF)
cp fonts/variable/*.ttf "${DEB_DIR}/usr/share/fonts/truetype/mona-sans-variable/"
# Install license as Debian copyright file
cp OFL.txt "${DEB_DIR}/usr/share/doc/${PKG}/copyright"
# Create control file
cat > "${DEB_DIR}/DEBIAN/control" << EOF
Package: ${PKG}
Version: ${VERSION}
Architecture: all
Section: fonts
Priority: optional
Depends: fontconfig
Installed-Size: $(du -sk "${DEB_DIR}/usr" | cut -f1)
Maintainer: GitHub <opensource+mona-sans@github.com>
Homepage: https://github.com/github/mona-sans
Description: Mona Sans and Mona Sans Mono typeface families
Mona Sans is a versatile typeface designed by GitHub together with
Degarism, inspired by industrial-era grotesques. It works well across
product, web, and print. This package includes both Mona Sans (with
weight range 200-900 and width range 75-125) and Mona Sans Mono, in
static and variable font formats.
EOF
# Strip leading whitespace from control file (heredoc indentation)
sed -i 's/^ //' "${DEB_DIR}/DEBIAN/control"
# Create triggers for fontconfig cache update
printf 'activate-noawait update-fontconfig-caches\n' > "${DEB_DIR}/DEBIAN/triggers"
# Build the package
dpkg-deb --build --root-owner-group "${DEB_DIR}"
# Validate with lintian (non-fatal)
sudo apt-get update -qq && sudo apt-get install -y -qq lintian > /dev/null 2>&1 || true
lintian "${DEB_DIR}.deb" || true
mkdir -p release-artifacts
mv "${DEB_DIR}.deb" "release-artifacts/${PKG}_${VERSION}_all.deb"
- name: Upload .deb artifact
uses: actions/upload-artifact@v4
with:
name: mona-sans-deb-v${{ steps.version.outputs.version }}
path: release-artifacts/*.deb
include-hidden-files: false
release:
runs-on: ubuntu-latest
needs: [build, build-deb]
steps:
- name: Download zip artifacts
uses: actions/download-artifact@v4
with:
name: mona-sans-release-zips-v${{ needs.build.outputs.version }}
path: release-artifacts/
- name: Download .deb artifact
uses: actions/download-artifact@v4
with:
name: mona-sans-deb-v${{ needs.build.outputs.version }}
path: release-artifacts/
- name: Create release notes
run: |
cat > release_notes.md << 'EOF'
# Mona Sans ${{ needs.build.outputs.tag }}
A versatile typeface, designed by GitHub together with Degarism and inspired by industrial-era grotesques. Mona Sans works well across product, web, and print.
## Font Packages
- **Static Fonts** - Individual OTF and TTF files for each weight, width, and style
- **Variable Fonts** - Modern variable font files with adjustable weight and width
- **Web Fonts** - WOFF/WOFF2 files optimized for web use
- **Complete Package** - All font formats in one download
- **Debian Package** - `.deb` package for Ubuntu 24.04 LTS (includes Mona Sans and Mona Sans Mono)
See the [README](https://github.com/github/mona-sans#readme) for detailed installation instructions.
## Font Specifications
- **Weight Range**: 200-900 (ExtraLight to Black)
- **Width Range**: 75-125 (Condensed to Expanded)
- **Styles**: Roman and Italic
- **Format Support**: OTF, TTF, Variable TTF, WOFF, WOFF2
EOF
- name: Create draft release with all assets
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.build.outputs.tag }}
name: Mona Sans ${{ needs.build.outputs.tag }}
body_path: release_notes.md
draft: true
prerelease: false
files: release-artifacts/*
- name: Summary
run: |
echo "## Release Summary" >> $GITHUB_STEP_SUMMARY
echo "Created draft release: **Mona Sans ${{ needs.build.outputs.tag }}**" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Uploaded Assets:" >> $GITHUB_STEP_SUMMARY
find release-artifacts -maxdepth 1 -type f -print0 | while IFS= read -r -d '' file; do
filename=$(basename "$file")
size=$(stat -c %s "$file")
hr_size=$(numfmt --to=iec-i --suffix=B "$size")
echo "- $filename ($hr_size)" >> $GITHUB_STEP_SUMMARY
done
echo "" >> $GITHUB_STEP_SUMMARY
echo "🔗 **[View Draft Release](https://github.com/${{ github.repository }}/releases/tag/${{ needs.build.outputs.tag }})**" >> $GITHUB_STEP_SUMMARY