Debian Codegraph @

workflows/build.yaml

raw
1 name: Build font and specimen
2
3 on: [push, release]
4
5 jobs:
6 build:
7 runs-on: ubuntu-latest
8 steps:
9 - uses: actions/checkout@v2
10 - name: Set up Python 3.8
11 uses: actions/setup-python@v2
12 with:
13 python-version: 3.8
14 - name: Install sys tools/deps
15 run: |
16 sudo apt-get update
17 sudo apt-get install ttfautohint
18 sudo snap install yq
19 - uses: actions/cache@v2
20 with:
21 path: ./venv/
22 key: ${{ runner.os }}-venv-${{ hashFiles('**/requirements*.txt') }}
23 restore-keys: |
24 ${{ runner.os }}-venv-
25 - name: Do first-run script if necessary
26 run: make .init.stamp
27 if: github.repository != 'googlefonts/Unified-Font-Repository'
28 - uses: stefanzweifel/git-auto-commit-action@v4
29 name: First-run setup
30 if: github.repository != 'googlefonts/Unified-Font-Repository'
31 with:
32 file_pattern: .init.stamp README.md requirements.txt
33 - name: gen zip file name
34 id: zip-name
35 shell: bash
36 # Set the archive name to repo name + "-assets" e.g "MavenPro-assets"
37 run: echo "ZIP_NAME=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')-fonts" >> $GITHUB_ENV
38 # If a new release is cut, use the release tag to auto-bump the source files
39 - name: Bump release
40 if: github.event_name == 'release'
41 run: |
42 . venv/bin/activate
43 SRCS=$(yq e ".sources[]" sources/config.yaml)
44 TAG_NAME=${GITHUB_REF/refs\/tags\//}
45 echo "Bumping $SRCS to $TAG_NAME"
46 for src in $SRCS
47 do
48 bumpfontversion sources/$src --new-version $TAG_NAME;
49 done
50 - name: Build font
51 run: make build
52 - name: Check with fontbakery
53 run: make test
54 continue-on-error: true
55 - name: proof
56 run: make proof
57 - name: setup site
58 run: cp scripts/index.html out/index.html
59 - name: Deploy
60 uses: peaceiris/actions-gh-pages@v3
61 if: ${{ github.ref == 'refs/heads/main' }}
62 with:
63 github_token: ${{ secrets.GITHUB_TOKEN }}
64 publish_dir: ./out
65 - name: Archive artifacts
66 uses: actions/upload-artifact@v2
67 with:
68 name: ${{ env.ZIP_NAME }}
69 path: |
70 fonts
71 out
72 outputs:
73 zip_name: ${{ env.ZIP_NAME }}
74 release:
75 # only run if the commit is tagged...
76 if: github.event_name == 'release'
77 # ... and it builds successfully
78 needs:
79 - build
80 runs-on: ubuntu-latest
81 env:
82 ZIP_NAME: ${{ needs.build.outputs.zip_name }}
83 steps:
84 - uses: actions/checkout@v2
85 - name: Download artefact files
86 uses: actions/download-artifact@v2
87 with:
88 name: ${{ env.ZIP_NAME }}
89 path: ${{ env.ZIP_NAME }}
90 - name: Zip files
91 run: zip -r ${{ env.ZIP_NAME }}.zip ${{ env.ZIP_NAME }}
92 - name: Upload binaries to release
93 uses: svenstaro/upload-release-action@v2
94 with:
95 repo_token: ${{ secrets.GITHUB_TOKEN }}
96 file: ${{ env.ZIP_NAME }}.zip
97 asset_name: ${{ env.ZIP_NAME }}.zip
98 tag: ${{ github.ref }}
99 overwrite: true
100 body: "Production ready fonts"