-
Notifications
You must be signed in to change notification settings - Fork 110
137 lines (116 loc) · 5.25 KB
/
release.yml
File metadata and controls
137 lines (116 loc) · 5.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
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
steps:
- name: Checkout code
uses: actions/checkout@v4
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: Build fonts
run: |
cd sources
bash build.sh
cd ..
env:
FB_CONTINUE_ON_ERROR: true
- 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: Create release notes
id: release_notes
run: |
cat > release_notes.md << 'EOF'
# Mona Sans ${{ steps.version.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
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 assets
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.tag }}
name: Mona Sans ${{ steps.version.outputs.tag }}
body_path: release_notes.md
draft: true
prerelease: false
files: |
release-artifacts/mona-sans-static-v${{ steps.version.outputs.version }}.zip
release-artifacts/mona-sans-variable-v${{ steps.version.outputs.version }}.zip
release-artifacts/mona-sans-webfonts-v${{ steps.version.outputs.version }}.zip
release-artifacts/mona-sans-complete-v${{ steps.version.outputs.version }}.zip
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: mona-sans-fonts-v${{ steps.version.outputs.version }}
path: fonts/
- name: Summary
run: |
echo "## Release Summary" >> $GITHUB_STEP_SUMMARY
echo "Created draft release: **Mona Sans ${{ steps.version.outputs.tag }}**" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Uploaded Assets:" >> $GITHUB_STEP_SUMMARY
find release-artifacts -maxdepth 1 -name '*.zip' -print0 | while IFS= read -r -d '' file; do
filename=$(basename "$file")
size=$(stat -c %s "$file")
# Convert size in bytes to human-readable format
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/${{ steps.version.outputs.tag }})**" >> $GITHUB_STEP_SUMMARY