Skip to content

Commit 4880c7d

Browse files
Merge pull request #106 from github/add-debian-package
Added Debian package for Mona Sans/Mono fonts
2 parents 3b40c4e + 5421403 commit 4880c7d

1 file changed

Lines changed: 138 additions & 26 deletions

File tree

.github/workflows/release.yml

Lines changed: 138 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ permissions:
1919
jobs:
2020
build:
2121
runs-on: ubuntu-latest
22+
outputs:
23+
version: ${{ steps.version.outputs.version }}
24+
tag: ${{ steps.version.outputs.tag }}
25+
tag_name: ${{ steps.version.outputs.tag }}
2226

2327
steps:
2428
- name: Checkout code
@@ -75,63 +79,171 @@ jobs:
7579
fonts/ -x "fonts/googlefonts/*" -x "fonts/googlefonts/**" \
7680
OFL.txt README.md
7781
82+
- name: Upload release zip artifacts
83+
uses: actions/upload-artifact@v4
84+
with:
85+
name: mona-sans-release-zips-v${{ steps.version.outputs.version }}
86+
path: release-artifacts/*.zip
87+
88+
- name: Upload font build artifacts
89+
uses: actions/upload-artifact@v4
90+
with:
91+
name: mona-sans-fonts-v${{ steps.version.outputs.version }}
92+
path: fonts/
93+
94+
build-deb:
95+
runs-on: ubuntu-24.04
96+
needs: [build]
97+
98+
steps:
99+
- name: Checkout code
100+
uses: actions/checkout@v4
101+
102+
- name: Download font artifacts
103+
uses: actions/download-artifact@v4
104+
with:
105+
name: mona-sans-fonts-v${{ needs.build.outputs.version }}
106+
path: .
107+
108+
- name: Extract version
109+
id: version
110+
run: |
111+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
112+
VERSION="${{ github.event.inputs.version }}"
113+
else
114+
VERSION=${GITHUB_REF#refs/tags/v}
115+
fi
116+
# Normalize to a valid Debian version: strip leading 'v', replace
117+
# characters illegal in dpkg versions, and prefix with '0~' when the
118+
# result doesn't start with a digit (Debian convention for pre-release)
119+
DEB_VERSION=$(echo "$VERSION" | awk '{sub(/^v/,""); gsub(/[^A-Za-z0-9.+~-]/,"."); if ($0 !~ /^[0-9]/) $0="0~"$0; print}')
120+
echo "version=${DEB_VERSION}" >> $GITHUB_OUTPUT
121+
122+
- name: Build .deb package
123+
run: |
124+
PKG="fonts-mona-sans"
125+
VERSION="${{ steps.version.outputs.version }}"
126+
DEB_DIR="${PKG}_${VERSION}_all"
127+
128+
# Create package directory structure
129+
mkdir -p "${DEB_DIR}/DEBIAN"
130+
mkdir -p "${DEB_DIR}/usr/share/fonts/truetype/mona-sans"
131+
mkdir -p "${DEB_DIR}/usr/share/fonts/truetype/mona-sans-variable"
132+
mkdir -p "${DEB_DIR}/usr/share/doc/${PKG}"
133+
134+
# Install static TTF files (Mona Sans + Mona Sans Mono)
135+
cp fonts/static/ttf/*.ttf "${DEB_DIR}/usr/share/fonts/truetype/mona-sans/"
136+
137+
# Install variable TTF files (Mona Sans VF + Mona Sans Mono VF)
138+
cp fonts/variable/*.ttf "${DEB_DIR}/usr/share/fonts/truetype/mona-sans-variable/"
139+
140+
# Install license as Debian copyright file
141+
cp OFL.txt "${DEB_DIR}/usr/share/doc/${PKG}/copyright"
142+
143+
# Create control file
144+
cat > "${DEB_DIR}/DEBIAN/control" << EOF
145+
Package: ${PKG}
146+
Version: ${VERSION}
147+
Architecture: all
148+
Section: fonts
149+
Priority: optional
150+
Depends: fontconfig
151+
Installed-Size: $(du -sk "${DEB_DIR}/usr" | cut -f1)
152+
Maintainer: GitHub <opensource+mona-sans@github.com>
153+
Homepage: https://github.com/github/mona-sans
154+
Description: Mona Sans and Mona Sans Mono typeface families
155+
Mona Sans is a versatile typeface designed by GitHub together with
156+
Degarism, inspired by industrial-era grotesques. It works well across
157+
product, web, and print. This package includes both Mona Sans (with
158+
weight range 200-900 and width range 75-125) and Mona Sans Mono, in
159+
static and variable font formats.
160+
EOF
161+
162+
# Strip leading whitespace from control file (heredoc indentation)
163+
sed -i 's/^ //' "${DEB_DIR}/DEBIAN/control"
164+
165+
# Create triggers for fontconfig cache update
166+
printf 'activate-noawait update-fontconfig-caches\n' > "${DEB_DIR}/DEBIAN/triggers"
167+
168+
# Build the package
169+
dpkg-deb --build --root-owner-group "${DEB_DIR}"
170+
171+
# Validate with lintian (non-fatal)
172+
sudo apt-get update -qq && sudo apt-get install -y -qq lintian > /dev/null 2>&1 || true
173+
lintian "${DEB_DIR}.deb" || true
174+
175+
mkdir -p release-artifacts
176+
mv "${DEB_DIR}.deb" "release-artifacts/${PKG}_${VERSION}_all.deb"
177+
178+
- name: Upload .deb artifact
179+
uses: actions/upload-artifact@v4
180+
with:
181+
name: mona-sans-deb-v${{ steps.version.outputs.version }}
182+
path: release-artifacts/*.deb
183+
184+
release:
185+
runs-on: ubuntu-latest
186+
needs: [build, build-deb]
187+
188+
steps:
189+
- name: Download zip artifacts
190+
uses: actions/download-artifact@v4
191+
with:
192+
name: mona-sans-release-zips-v${{ needs.build.outputs.version }}
193+
path: release-artifacts/
194+
195+
- name: Download .deb artifact
196+
uses: actions/download-artifact@v4
197+
with:
198+
name: mona-sans-deb-v${{ needs.build-deb.outputs.version }}
199+
path: release-artifacts/
200+
78201
- name: Create release notes
79-
id: release_notes
80202
run: |
81203
cat > release_notes.md << 'EOF'
82-
# Mona Sans ${{ steps.version.outputs.tag }}
204+
# Mona Sans ${{ needs.build.outputs.tag }}
83205
84206
A versatile typeface, designed by GitHub together with Degarism and inspired by industrial-era grotesques. Mona Sans works well across product, web, and print.
85207
86208
## Font Packages
87-
209+
88210
- **Static Fonts** - Individual OTF and TTF files for each weight, width, and style
89211
- **Variable Fonts** - Modern variable font files with adjustable weight and width
90212
- **Web Fonts** - WOFF/WOFF2 files optimized for web use
91213
- **Complete Package** - All font formats in one download
92-
214+
- **Debian Package** - `.deb` package for Ubuntu 24.04 LTS (includes Mona Sans and Mona Sans Mono)
215+
93216
See the [README](https://github.com/github/mona-sans#readme) for detailed installation instructions.
94-
217+
95218
## Font Specifications
96-
219+
97220
- **Weight Range**: 200-900 (ExtraLight to Black)
98221
- **Width Range**: 75-125 (Condensed to Expanded)
99222
- **Styles**: Roman and Italic
100223
- **Format Support**: OTF, TTF, Variable TTF, WOFF, WOFF2
101224
EOF
102-
103-
- name: Create draft release with assets
225+
226+
- name: Create draft release with all assets
104227
uses: softprops/action-gh-release@v2
105228
with:
106-
tag_name: ${{ steps.version.outputs.tag }}
107-
name: Mona Sans ${{ steps.version.outputs.tag }}
229+
tag_name: ${{ needs.build.outputs.tag }}
230+
name: Mona Sans ${{ needs.build.outputs.tag }}
108231
body_path: release_notes.md
109232
draft: true
110233
prerelease: false
111-
files: |
112-
release-artifacts/mona-sans-static-v${{ steps.version.outputs.version }}.zip
113-
release-artifacts/mona-sans-variable-v${{ steps.version.outputs.version }}.zip
114-
release-artifacts/mona-sans-webfonts-v${{ steps.version.outputs.version }}.zip
115-
release-artifacts/mona-sans-complete-v${{ steps.version.outputs.version }}.zip
116-
117-
- name: Upload build artifacts
118-
uses: actions/upload-artifact@v4
119-
with:
120-
name: mona-sans-fonts-v${{ steps.version.outputs.version }}
121-
path: fonts/
122-
234+
files: release-artifacts/*
235+
123236
- name: Summary
124237
run: |
125238
echo "## Release Summary" >> $GITHUB_STEP_SUMMARY
126-
echo "Created draft release: **Mona Sans ${{ steps.version.outputs.tag }}**" >> $GITHUB_STEP_SUMMARY
239+
echo "Created draft release: **Mona Sans ${{ needs.build.outputs.tag }}**" >> $GITHUB_STEP_SUMMARY
127240
echo "" >> $GITHUB_STEP_SUMMARY
128241
echo "### Uploaded Assets:" >> $GITHUB_STEP_SUMMARY
129-
find release-artifacts -maxdepth 1 -name '*.zip' -print0 | while IFS= read -r -d '' file; do
242+
find release-artifacts -maxdepth 1 -type f -print0 | while IFS= read -r -d '' file; do
130243
filename=$(basename "$file")
131244
size=$(stat -c %s "$file")
132-
# Convert size in bytes to human-readable format
133245
hr_size=$(numfmt --to=iec-i --suffix=B "$size")
134246
echo "- $filename ($hr_size)" >> $GITHUB_STEP_SUMMARY
135247
done
136248
echo "" >> $GITHUB_STEP_SUMMARY
137-
echo "🔗 **[View Draft Release](https://github.com/${{ github.repository }}/releases/tag/${{ steps.version.outputs.tag }})**" >> $GITHUB_STEP_SUMMARY
249+
echo "🔗 **[View Draft Release](https://github.com/${{ github.repository }}/releases/tag/${{ needs.build.outputs.tag }})**" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)