Skip to content

Commit eba490a

Browse files
committed
2 parents 0a9e1d3 + 6a03a8c commit eba490a

15 files changed

+1360
-193
lines changed

.github/workflows/build.yaml

Lines changed: 63 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,47 @@
11
name: Build font and specimen
22

3-
on: [push, release]
3+
on: push
44

55
jobs:
66
build:
7+
name: Build and test
78
runs-on: ubuntu-latest
89
steps:
9-
- uses: actions/checkout@v2
10-
- name: Set up Python 3.8
11-
uses: actions/setup-python@v2
10+
- uses: actions/checkout@v4
11+
- name: Set up Python 3.10
12+
uses: actions/setup-python@v5
1213
with:
13-
python-version: 3.8
14+
python-version: "3.10"
1415
- name: Install sys tools/deps
1516
run: |
1617
sudo apt-get update
1718
sudo apt-get install ttfautohint
1819
sudo snap install yq
19-
- uses: actions/cache@v2
20+
- uses: actions/cache@v4
2021
with:
2122
path: ./venv/
2223
key: ${{ runner.os }}-venv-${{ hashFiles('**/requirements*.txt') }}
2324
restore-keys: |
2425
${{ runner.os }}-venv-
25-
- name: Do first-run script if necessary
26-
run: make .init.stamp
27-
if: github.repository != 'googlefonts/googlefonts-project-template'
28-
- uses: stefanzweifel/git-auto-commit-action@v4
29-
name: First-run setup
30-
if: github.repository != 'googlefonts/googlefonts-project-template'
31-
with:
32-
file_pattern: .init.stamp README.md requirements.txt OFL.txt
33-
commit_message: "Personalize for this repo"
3426
- name: gen zip file name
3527
id: zip-name
3628
shell: bash
3729
# Set the archive name to repo name + "-assets" e.g "MavenPro-assets"
3830
run: echo "ZIP_NAME=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')-fonts" >> $GITHUB_ENV
39-
# If a new release is cut, use the release tag to auto-bump the source files
40-
- name: Bump release
41-
if: github.event_name == 'release'
42-
run: |
43-
. venv/bin/activate
44-
SRCS=$(yq e ".sources[]" sources/config.yaml)
45-
TAG_NAME=${GITHUB_REF/refs\/tags\//}
46-
echo "Bumping $SRCS to $TAG_NAME"
47-
for src in $SRCS
48-
do
49-
bumpfontversion sources/$src --new-version $TAG_NAME;
50-
done
31+
32+
# If a new release is cut, use the release tag to auto-bump the source files
33+
# - name: Bump release
34+
# if: github.event_name == 'release'
35+
# run: |
36+
# . venv/bin/activate
37+
# SRCS=$(yq e ".sources[]" sources/config.yaml)
38+
# TAG_NAME=${GITHUB_REF/refs\/tags\//}
39+
# echo "Bumping $SRCS to $TAG_NAME"
40+
# for src in $SRCS
41+
# do
42+
# bumpfontversion sources/$src --new-version $TAG_NAME;
43+
# done
44+
5145
- name: Build font
5246
run: make build
5347
- name: Check with fontbakery
@@ -58,44 +52,65 @@ jobs:
5852
- name: setup site
5953
run: cp scripts/index.html out/index.html
6054
- name: Deploy
61-
uses: peaceiris/actions-gh-pages@v3
55+
uses: peaceiris/actions-gh-pages@v4
6256
if: ${{ github.ref == 'refs/heads/main' }}
6357
with:
6458
github_token: ${{ secrets.GITHUB_TOKEN }}
6559
publish_dir: ./out
6660
- name: Archive artifacts
67-
uses: actions/upload-artifact@v2
61+
uses: actions/upload-artifact@v4
6862
with:
6963
name: ${{ env.ZIP_NAME }}
7064
path: |
7165
fonts
7266
out
7367
outputs:
7468
zip_name: ${{ env.ZIP_NAME }}
69+
70+
# There are two ways a release can be created: either by pushing a tag, or by
71+
# creating a release from the GitHub UI. Pushing a tag does not automatically
72+
# create a release, so we have to do that ourselves. However, creating a
73+
# release from the GitHub UI *does* push a tag, and we don't want to create
74+
# a new release in that case because one already exists!
75+
7576
release:
76-
# only run if the commit is tagged...
77-
if: github.event_name == 'release'
78-
# ... and it builds successfully
79-
needs:
80-
- build
77+
name: Create and populate release
78+
needs: build
8179
runs-on: ubuntu-latest
80+
if: contains(github.ref, 'refs/tags/')
8281
env:
8382
ZIP_NAME: ${{ needs.build.outputs.zip_name }}
83+
GH_TOKEN: ${{ github.token }}
8484
steps:
85-
- uses: actions/checkout@v2
86-
- name: Download artefact files
87-
uses: actions/download-artifact@v2
85+
- uses: actions/checkout@v4
86+
- name: Download font artefact files
87+
uses: actions/download-artifact@v4
8888
with:
8989
name: ${{ env.ZIP_NAME }}
9090
path: ${{ env.ZIP_NAME }}
91-
- name: Zip files
92-
run: zip -r ${{ env.ZIP_NAME }}.zip ${{ env.ZIP_NAME }}
93-
- name: Upload binaries to release
94-
uses: svenstaro/upload-release-action@v2
95-
with:
96-
repo_token: ${{ secrets.GITHUB_TOKEN }}
97-
file: ${{ env.ZIP_NAME }}.zip
98-
asset_name: ${{ env.ZIP_NAME }}.zip
99-
tag: ${{ github.ref }}
100-
overwrite: true
101-
body: "Production ready fonts"
91+
- name: Copy DESCRIPTION.en_us.html to artefact directory
92+
run: cp documentation/DESCRIPTION.en_us.html ${{ env.ZIP_NAME }}/DESCRIPTION.en_us.html
93+
- name: Copy ARTICLE.en_us.html to artefact directory
94+
run: cp documentation/ARTICLE.en_us.html ${{ env.ZIP_NAME }}/ARTICLE.en_us.html
95+
continue-on-error: true
96+
- name: Copy OFL.txt to artefact directory
97+
run: cp OFL.txt ${{ env.ZIP_NAME }}/OFL.txt
98+
- name: Remove proof/fontbakery stuff from release
99+
run: rm -rf ${{ env.ZIP_NAME }}/out
100+
- name: gen release file name
101+
shell: bash
102+
run: echo "RELEASE_ZIP_NAME=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')-${{github.ref_name}}" >> $GITHUB_ENV
103+
- name: Create release bundle
104+
run: mv ${{ env.ZIP_NAME }} ${{ env.RELEASE_ZIP_NAME }}; zip -r ${{ env.RELEASE_ZIP_NAME }}.zip ${{ env.RELEASE_ZIP_NAME }}
105+
- name: Check for release
106+
id: create_release
107+
run: |
108+
if ! gh release view ${{ github.ref_name }}; then
109+
git show -s --format=%B ${{ github.ref_name }} | tail -n +4 | gh release create ${{ github.ref_name }} -t ${{ github.ref_name }} -F -
110+
fi
111+
- name: Populate release
112+
run: |
113+
gh release upload ${{ github.ref_name }} ${{ env.RELEASE_ZIP_NAME }}.zip --clobber
114+
- name: Set release live
115+
run: |
116+
gh release edit ${{ github.ref_name }} --draft=false

Makefile

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,35 +18,53 @@ build: build.stamp
1818

1919
venv: venv/touchfile
2020

21-
build.stamp: venv .init.stamp sources/config.yaml $(SOURCES)
22-
. venv/bin/activate; rm -rf fonts/; gftools builder sources/config.yaml && touch build.stamp
21+
venv-test: venv-test/touchfile
2322

24-
.init.stamp: venv
25-
. venv/bin/activate; python3 scripts/first-run.py
23+
customize: venv
24+
. venv/bin/activate; python3 scripts/customize.py
25+
26+
build.stamp: venv sources/config.yaml $(SOURCES)
27+
rm -rf fonts
28+
(for config in sources/config*.yaml; do . venv/bin/activate; gftools builder $$config; done) && touch build.stamp
2629

2730
venv/touchfile: requirements.txt
2831
test -d venv || python3 -m venv venv
2932
. venv/bin/activate; pip install -Ur requirements.txt
3033
touch venv/touchfile
3134

32-
test: venv build.stamp
33-
. venv/bin/activate; mkdir -p out/ out/fontbakery; fontbakery check-googlefonts -l WARN --succinct --badges out/badges --html out/fontbakery/fontbakery-report.html --ghmarkdown out/fontbakery/fontbakery-report.md $(shell find fonts/ttf -type f)
35+
venv-test/touchfile: requirements-test.txt
36+
test -d venv-test || python3 -m venv venv-test
37+
. venv-test/bin/activate; pip install -Ur requirements-test.txt
38+
touch venv-test/touchfile
39+
40+
test: venv-test build.stamp
41+
TOCHECK=$$(find fonts/variable -type f 2>/dev/null); if [ -z "$$TOCHECK" ]; then TOCHECK=$$(find fonts/ttf -type f 2>/dev/null); fi ; . venv-test/bin/activate; mkdir -p out/ out/fontbakery; fontbakery check-googlefonts -l WARN --full-lists --succinct --badges out/badges --html out/fontbakery/fontbakery-report.html --ghmarkdown out/fontbakery/fontbakery-report.md $$TOCHECK || echo '::warning file=sources/config.yaml,title=Fontbakery failures::The fontbakery QA check reported errors in your font. Please check the generated report.'
3442

3543
proof: venv build.stamp
36-
. venv/bin/activate; mkdir -p out/ out/proof; gftools gen-html proof $(shell find fonts/ttf -type f) -o out/proof
44+
TOCHECK=$$(find fonts/variable -type f 2>/dev/null); if [ -z "$$TOCHECK" ]; then TOCHECK=$$(find fonts/ttf -type f 2>/dev/null); fi ; . venv/bin/activate; mkdir -p out/ out/proof; diffenator2 proof $$TOCHECK -o out/proof
3745

38-
images: venv build.stamp $(DRAWBOT_OUTPUT)
39-
git add documentation/*.png && git commit -m "Rebuild images" documentation/*.png
46+
images: venv $(DRAWBOT_OUTPUT)
4047

4148
%.png: %.py build.stamp
42-
python3 $< --output $@
49+
. venv/bin/activate; python3 $< --output $@
4350

4451
clean:
4552
rm -rf venv
46-
find . -name "*.pyc" | xargs rm delete
53+
find . -name "*.pyc" -delete
54+
55+
update-project-template:
56+
npx update-template https://github.com/googlefonts/googlefonts-project-template/
57+
58+
update: venv venv-test
59+
venv/bin/pip install --upgrade pip-tools
60+
# See https://pip-tools.readthedocs.io/en/latest/#a-note-on-resolvers for
61+
# the `--resolver` flag below.
62+
venv/bin/pip-compile --upgrade --verbose --resolver=backtracking requirements.in
63+
venv/bin/pip-sync requirements.txt
4764

48-
update-ufr:
49-
npx update-template https://github.com/googlefonts/Unified-Font-Repository/
65+
venv-test/bin/pip install --upgrade pip-tools
66+
venv-test/bin/pip-compile --upgrade --verbose --resolver=backtracking requirements-test.in
67+
venv-test/bin/pip-sync requirements-test.txt
5068

51-
update:
52-
pip install --upgrade $(dependency); pip freeze > requirements.txt
69+
git commit -m "Update requirements" requirements.txt requirements-test.txt
70+
git push

documentation/DESCRIPTION.en_us.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<p>
2+
Please add a text describing the font here, 100 chracters or more, but no more than 500 words.
3+
See https://googlefonts.github.io/gf-guide/description.html for further reference.
4+
Please make sure that HTML characters are properly encoded. ('&' becomes &amp; etc.)
5+
If unsure, use https://www.freeformatter.com/html-escape.html for formatting. (Use "Escape HTML").
6+
</p>
7+
<p>
8+
Could be several paragraphs, also.
9+
</p>
10+
<p>
11+
To contribute, see <a href="https://github.com/youruseraccount/yourrepository">github.com/youruseraccount/yourrepository</a>.
12+
</p>

documentation/image1.png

8.41 KB
Loading

documentation/image1.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,18 @@
1515
import argparse
1616

1717
# Constants, these are the main "settings" for the image
18-
WIDTH, HEIGHT, MARGIN, FRAMES = 2048, 2048, 128, 1
19-
FONT_PATH = "fonts/ttf/Merriweather-Regular.ttf"
18+
WIDTH, HEIGHT, MARGIN, FRAMES = 2048, 1024, 128, 1
19+
FONT_PATH = "fonts/ttf/RadioCanadaDisplay-Regular.ttf"
2020
FONT_LICENSE = "OFL v1.1"
2121
AUXILIARY_FONT = "Helvetica"
2222
AUXILIARY_FONT_SIZE = 48
23-
BIG_TEXT = "Aa"
24-
BIG_TEXT_FONT_SIZE = 1024
25-
BIG_TEXT_SIDE_MARGIN = MARGIN * 3.1
26-
BIG_TEXT_BOTTOM_MARGIN = MARGIN * 5.5
27-
GRID_VIEW = False # Change this to "True" for a grid overlay
23+
24+
BIG_TEXT = "AaBb"
25+
BIG_TEXT_FONT_SIZE = 730
26+
BIG_TEXT_SIDE_MARGIN = MARGIN * 1
27+
BIG_TEXT_BOTTOM_MARGIN = MARGIN * 2
28+
29+
GRID_VIEW = False # Toggle this for a grid overlay
2830

2931
# Handel the "--output" flag
3032
# For example: $ python3 documentation/image1.py --output documentation/image1.png
@@ -98,9 +100,9 @@ def draw_main_text():
98100
# Divider lines
99101
def draw_divider_lines():
100102
stroke(1)
101-
strokeWidth(4)
103+
strokeWidth(5)
102104
lineCap("round")
103-
line((MARGIN, HEIGHT - MARGIN), (WIDTH - MARGIN, HEIGHT - MARGIN))
105+
line((MARGIN, HEIGHT - (MARGIN * 1.5)), (WIDTH - MARGIN, HEIGHT - (MARGIN * 1.5)))
104106
line((MARGIN, MARGIN + (MARGIN / 2)), (WIDTH - MARGIN, MARGIN + (MARGIN / 2)))
105107
stroke(None)
106108

@@ -110,8 +112,8 @@ def draw_auxiliary_text():
110112
# Setup
111113
font(AUXILIARY_FONT)
112114
fontSize(AUXILIARY_FONT_SIZE)
113-
POS_TOP_LEFT = (MARGIN, HEIGHT - MARGIN * 1.5)
114-
POS_TOP_RIGHT = (WIDTH - MARGIN, HEIGHT - MARGIN * 1.5)
115+
POS_TOP_LEFT = (MARGIN, HEIGHT - MARGIN * 1.25)
116+
POS_TOP_RIGHT = (WIDTH - MARGIN, HEIGHT - MARGIN * 1.25)
115117
POS_BOTTOM_LEFT = (MARGIN, MARGIN)
116118
POS_BOTTOM_RIGHT = (WIDTH - MARGIN * 0.95, MARGIN)
117119
URL_AND_HASH = MY_URL + "at commit " + MY_HASH

documentation/image2.png

211 KB
Loading

0 commit comments

Comments
 (0)