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 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358
|
name: Build, QA, release
on:
workflow_call:
secrets:
USER_GITHUB_TOKEN:
description: "A github token representing the Google Fonts onboarder's account"
required: false
SSH_KEY:
description: "An SSH key for the Google Fonts onboarder"
required: false
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
build-all:
runs-on: ubuntu-latest
name: Build main TTFs
steps:
- uses: actions/checkout@v4
- name: Set up latest harfbuzz
uses: notofonts/install-harfbuzz-action@main
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install the latest version of uv
uses: eifinger/setup-uv@v1
with:
enable-cache: true
- name: Install Python deps
run: |
uv venv venv; . venv/bin/activate ; uv pip install -r requirements.txt
touch venv/touchfile
- name: Do first-run script if necessary
run: make .init.stamp
if: github.repository != 'notofonts/noto-project-template'
- uses: stefanzweifel/git-auto-commit-action@v5
name: First-run setup
if: github.repository != 'notofonts/noto-project-template'
with:
file_pattern: .init.stamp README.md requirements.txt OFL.txt
commit_message: "Personalize for this repo"
- name: Build fonts
run: make build
- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: fontbuild
path: fonts
fontspector-googlefonts:
name: Check with fontspector
runs-on: ubuntu-latest
needs: build-all
steps:
- uses: actions/checkout@v4
- name: Download font build zip
uses: actions/download-artifact@v4
with:
name: fontbuild
path: fonts
- name: Set up Fontspector
uses: fonttools/setup-fontspector@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Make directories
run: mkdir -p out/fontspector out/badges
continue-on-error: true
- name: Install the latest version of uv
uses: eifinger/setup-uv@v1
with:
enable-cache: true
- name: Install Python deps
run: |
uv venv venv; . venv/bin/activate ; uv pip install -r requirements.txt
touch venv/touchfile
- name: Check with fontspector
run: |
. venv/bin/activate ; python3 -m notoqa
continue-on-error: true
- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: fontspector-googlefonts
path: out
proof:
name: Create proof documents
runs-on: ubuntu-latest
needs: build-all
steps:
- uses: actions/checkout@v4
- name: Download font build zip
uses: actions/download-artifact@v4
with:
name: fontbuild
path: fonts
- name: Install xml2/xslt/cairo dev
run: sudo apt-get install libxml2-dev libxslt1-dev libcairo2-dev
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install the latest version of uv
uses: eifinger/setup-uv@v1
with:
enable-cache: true
- name: Install Python deps
run: |
uv venv venv; . venv/bin/activate ; uv pip install -r requirements.txt
touch venv/touchfile
- name: Make proof
run: |
. venv/bin/activate; mkdir -p out/ out/proof; for i in fonts/* ; do family=`basename $i`; diffenator2 proof $(find fonts/$family/unhinted/ttf -type f) -o out/proof/$family; done
- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: proof
path: out
regression:
name: Regression test
runs-on: ubuntu-latest
needs: build-all
steps:
- uses: actions/checkout@v4
- name: Download font build zip
uses: actions/download-artifact@v4
with:
name: fontbuild
path: fonts
- name: Set up diffenator3
uses: notofonts/install-diffenator3-action@main
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install the latest version of uv
uses: eifinger/setup-uv@v1
with:
enable-cache: true
- name: Install xml2/xslt/cairo dev
run: sudo apt-get install libxml2-dev libxslt1-dev libcairo2-dev
- name: Install Python deps
run: |
uv venv venv; . venv/bin/activate ; uv pip install -r requirements.txt
touch venv/touchfile
- name: Regression test
run: . venv/bin/activate; python3 -m notoqa.regression
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: regression
path: out
report:
name: Rebuild website
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs:
- fontspector-googlefonts
- proof
- regression
steps:
- uses: actions/checkout@v4
- name: Download font zip
uses: actions/download-artifact@v4
with:
name: fontbuild
path: fonts
- name: Download fontspector-googlefonts zip
uses: actions/download-artifact@v4
with:
name: fontspector-googlefonts
path: out
- name: Download proof zip
uses: actions/download-artifact@v4
with:
name: proof
path: out
continue-on-error: true
- name: Download regression test zip
uses: actions/download-artifact@v4
with:
name: regression
path: out
continue-on-error: true
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install the latest version of uv
uses: eifinger/setup-uv@v1
with:
enable-cache: true
- name: Install xml2/xslt/cairo dev
run: sudo apt-get install libxml2-dev libxslt1-dev libcairo2-dev
- name: Install Python deps
run: |
uv venv venv; . venv/bin/activate ; uv pip install -r requirements.txt
touch venv/touchfile
- name: Rebuild website
run: . venv/bin/activate; python3 -m notobuilder.ghpages
- name: Copy fonts to gh-pages dir
run: cp -r fonts out
- name: Deploy
uses: actions/upload-pages-artifact@v3.0.1
if: ${{ github.ref == 'refs/heads/main' }}
with:
path: ./out
- name: gen zip file name
id: zip-name
shell: bash
# Set the archive name to repo name + "-assets" e.g "MavenPro-assets"
run: echo "ZIP_NAME=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')-fonts" >> $GITHUB_ENV
- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ env.ZIP_NAME }}
path: out
deploy:
name: Deploy website to GitHub Pages
needs: report
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
create_release:
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
needs:
- build-all
runs-on: ubuntu-latest
name: Create release
outputs:
url: ${{ steps.upload.outputs.browser_download_url }}
config_file: ${{ steps.check_tag.outputs.config_file }}
family: ${{ steps.check_tag.outputs.family }}
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- run: pip3 install 'git+https://github.com/googlefonts/gftools'
- name: Download font zip
uses: actions/download-artifact@v4
with:
name: fontbuild
path: fonts
- name: Install the latest version of uv
uses: eifinger/setup-uv@v1
with:
enable-cache: true
- name: Install Python deps
run: |
uv venv venv; . venv/bin/activate ; uv pip install -r requirements.txt
touch venv/touchfile
- name: Check for appropriate tag
id: check_tag
run: . venv/bin/activate; python3 scripts/check-tag.py ${{ github.ref_name }}
- name: Set release body from tag
run: |
echo 'RELEASE_NOTES<<EOF' >> "$GITHUB_ENV"
git show -s --format=%B ${{ github.ref_name }} | tail -n +4 >> "$GITHUB_ENV"
echo 'EOF' >> "$GITHUB_ENV"
- name: Create release
id: release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
release_name: ${{ github.ref_name }}
body: ${{ env.RELEASE_NOTES }}
- name: Tell user about release
run: |
echo '::warning file=sources/config.yaml,title=A new release ${{ github.ref_name }} has been created'
git show -s --format=%B ${{ github.ref_name }} | tail -n +4
echo "$RELEASE_NOTES"
- name: Find a DESCRIPTION.en_us.html
run: cp documentation/${{ steps.check_tag.outputs.family}}.html fonts/DESCRIPTION.en_us.html
continue-on-error: true
- name: Find an ARTICLE.en_us.html
run: cp documentation/${{ steps.check_tag.outputs.family}}.article.html fonts/ARTICLE.en_us.html
continue-on-error: true
- name: Create release bundle
run: cd fonts; cp ../*.txt . ; zip -x requirements.txt -r ../${{ github.ref_name }}.zip ${{ steps.check_tag.outputs.family}}/ *.txt DESCRIPTION.en_us.html ARTICLE.en_us.html
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
id: upload
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ github.ref_name }}.zip
asset_name: ${{ github.ref_name }}.zip
tag: ${{ github.ref_name }}
overwrite: true
body: ${{ env.RELEASE_NOTES }}
google_fonts_pr:
runs-on: ubuntu-latest
environment: googlefonts
name: Submit PR to Google Fonts
needs: create_release
steps:
- name: Check SSH_KEY is set
run: |
if [[ "${{ secrets.SSH_KEY }}" == "" ]];
then
echo "::error file=sources/config.yaml,title=SSH_KEY was not set in repository secrets::Generate an SSH key (https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#generating-a-new-ssh-key), add the public key to your GitHub account (https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account) and add the private key to an environment secret called SSH_KEY in an environment called 'googlefonts' by going to $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/settings/secrets/actions";
exit 1
fi
- name: Check USER_GITHUB_TOKEN is set
run: |
if [[ "${{ secrets.USER_GITHUB_TOKEN }}" == "" ]];
then
echo "::error file=sources/config.yaml,title=USER_GITHUB_TOKEN was not set in repository secrets::Generate a personal access token with a repo scope by visiting https://github.com/settings/tokens/new and add it to an environment secret called USER_GITHUB_TOKEN in an environment called 'googlefonts' by going to $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/settings/secrets/actions";
exit 1
fi
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- run: pip3 install 'git+https://github.com/googlefonts/gftools#egg=gftools'
- uses: actions/checkout@v4
name: Check out Google Fonts repository
with:
fetch-depth: 0
repository: google/fonts
path: "googlefonts"
ssh-key: ${{ secrets.SSH_KEY }}
- name: Set git username and email
run: |
git config --global user.email "${GH_USERNAME}@users.noreply.github.com"
git config --global user.name "${GH_USERNAME}"
env:
GH_USERNAME: ${{ github.actor }}
- name: Do SSH magic
run: cd googlefonts; git remote add googlefonts git@github.com:google/fonts.git ; cd ..
- name: Test fetch
run: cd googlefonts; git fetch googlefonts main ; cd ..
- name: Run the packager
run: gftools-packager `echo ${{needs.create_release.outputs.family}} | tr 'A-Z' 'a-z'` googlefonts --latest-release -p --show-tracebacks
env:
GH_TOKEN: ${{ secrets.USER_GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.USER_GITHUB_TOKEN }}
|