11name : Build font and specimen
22
3- on : [push, release ]
3+ on : [push, pull_request, workflow_dispatch ]
44
55jobs :
66 build :
7+ name : Build and test
78 runs-on : ubuntu-latest
89 steps :
9- - uses : actions/checkout@v3
10- - name : Set up Python 3.10
11- uses : actions/setup-python@v2
10+ - uses : actions/checkout@v4
11+ - name : Set up Python 3.11
12+ uses : actions/setup-python@v6
1213 with :
13- python-version : " 3.10"
14- - name : Install sys tools/deps
14+ python-version : " 3.11"
15+ - name : Setup fontspector
16+ uses : fonttools/setup-fontspector@main
17+ env :
18+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
19+ - name : Install toolset
1520 run : |
1621 sudo apt-get update
17- sudo apt-get install ttfautohint
22+ sudo apt-get install ttfautohint libcairo2-dev python3-cairo-dev pkg-config python3-dev
1823 sudo snap install yq
19- - uses : actions/cache@v2
24+ - uses : actions/cache@v4
2025 with :
2126 path : ./venv/
2227 key : ${{ runner.os }}-venv-${{ hashFiles('**/requirements*.txt') }}
2328 restore-keys : |
2429 ${{ 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"
34- - name : gen zip file name
30+ - name : Set artifact file name
3531 id : zip-name
3632 shell : bash
37- # Set the archive name to repo name + "-assets " e.g "MavenPro-assets "
33+ # Set the archive name to repo name + "-fonts " e.g "radiocanadafonts-fonts.zip "
3834 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
35+
36+ # If a new release is cut, use the release tag to auto-bump the source files
37+ # - name: Bump release
38+ # if: github.event_name == 'release'
39+ # run: |
40+ # . venv/bin/activate
41+ # SRCS=$(yq e ".sources[]" sources/config.yaml)
42+ # TAG_NAME=${GITHUB_REF/refs\/tags\//}
43+ # echo "Bumping $SRCS to $TAG_NAME"
44+ # for src in $SRCS
45+ # do
46+ # bumpfontversion sources/$src --new-version $TAG_NAME;
47+ # done
48+
5149 - name : Build font
5250 run : make build
53- - name : Check with fontbakery
51+ - name : Check with fontspector
5452 run : make test
5553 continue-on-error : true
56- - name : proof
54+ - name : Generate proofs
5755 run : make proof
58- - name : setup site
56+ - name : Set up test result site
5957 run : cp scripts/index.html out/index.html
60- - name : Deploy
61- uses : peaceiris/actions-gh-pages@v3
58+ - name : Collect deployment assets
6259 if : ${{ github.ref == 'refs/heads/main' }}
60+ uses : actions/upload-pages-artifact@v3
6361 with :
64- github_token : ${{ secrets.GITHUB_TOKEN }}
65- publish_dir : ./out
62+ path : ./out
6663 - name : Archive artifacts
67- uses : actions/upload-artifact@v2
64+ uses : actions/upload-artifact@v4
6865 with :
6966 name : ${{ env.ZIP_NAME }}
7067 path : |
7168 fonts
7269 out
7370 outputs :
7471 zip_name : ${{ env.ZIP_NAME }}
72+
73+ deploy :
74+ name : Deploy results to GitHub Pages
75+ if : ${{ github.ref == 'refs/heads/main' }}
76+ needs : build
77+ runs-on : ubuntu-latest
78+ permissions :
79+ pages : write
80+ id-token : write
81+ environment :
82+ name : github-pages
83+ url : ${{ steps.deployment.outputs.page_url }}
84+ steps :
85+ - name : Deploy to GitHub Pages
86+ id : deployment
87+ uses : actions/deploy-pages@v4
88+
89+ # There are two ways a release can be created: either by pushing a tag, or by
90+ # creating a release from the GitHub UI. Pushing a tag does not automatically
91+ # create a release, so we have to do that ourselves. However, creating a
92+ # release from the GitHub UI *does* push a tag, and we don't want to create
93+ # a new release in that case because one already exists!
94+
7595 release :
76- # only run if the commit is tagged...
77- if : github.event_name == 'release'
78- # ... and it builds successfully
79- needs :
80- - build
96+ name : Release bundle
97+ if : contains(github.ref, 'refs/tags/')
98+ needs : build
8199 runs-on : ubuntu-latest
82100 env :
83101 ZIP_NAME : ${{ needs.build.outputs.zip_name }}
102+ GH_TOKEN : ${{ github.token }}
84103 steps :
85- - uses : actions/checkout@v3
86- - name : Download artefact files
87- uses : actions/download-artifact@v2
104+ - uses : actions/checkout@v4
105+ - name : Use font artifacts from CI
106+ uses : actions/download-artifact@v5
88107 with :
89108 name : ${{ env.ZIP_NAME }}
90109 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"
110+ - name : Copy DESCRIPTION.en_us.html to release directory
111+ run : cp documentation/DESCRIPTION.en_us.html ${{ env.ZIP_NAME }}/DESCRIPTION.en_us.html
112+ - name : Copy ARTICLE.en_us.html to release directory
113+ run : cp documentation/ARTICLE.en_us.html ${{ env.ZIP_NAME }}/ARTICLE.en_us.html
114+ continue-on-error : true
115+ - name : Copy OFL.txt to release directory
116+ run : cp OFL.txt ${{ env.ZIP_NAME }}/OFL.txt
117+ - name : Remove proof/test outputs from release
118+ run : rm -rf ${{ env.ZIP_NAME }}/out
119+ - name : Set release file name
120+ shell : bash
121+ run : echo "RELEASE_ZIP_NAME=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')-${{github.ref_name}}" >> $GITHUB_ENV
122+ - name : Create release bundle
123+ run : mv ${{ env.ZIP_NAME }} ${{ env.RELEASE_ZIP_NAME }}; zip -r ${{ env.RELEASE_ZIP_NAME }}.zip ${{ env.RELEASE_ZIP_NAME }}
124+ - name : Check for release
125+ id : create_release
126+ run : |
127+ if ! gh release view ${{ github.ref_name }}; then
128+ git show -s --format=%B ${{ github.ref_name }} | tail -n +4 | gh release create ${{ github.ref_name }} -t ${{ github.ref_name }} -F -
129+ fi
130+ - name : Populate release
131+ run : |
132+ gh release upload ${{ github.ref_name }} ${{ env.RELEASE_ZIP_NAME }}.zip --clobber
133+ - name : Set release live
134+ run : |
135+ gh release edit ${{ github.ref_name }} --draft=false
0 commit comments