| 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: Build font |
| 40 |
run: make build |
| 41 |
- name: Check with fontbakery |
| 42 |
run: make test |
| 43 |
continue-on-error: true |
| 44 |
- name: proof |
| 45 |
run: make proof |
| 46 |
- name: setup site |
| 47 |
run: cp scripts/index.html out/index.html |
| 48 |
- name: Deploy |
| 49 |
uses: peaceiris/actions-gh-pages@v3 |
| 50 |
if: ${{ github.ref == 'refs/heads/main' }} |
| 51 |
with: |
| 52 |
github_token: ${{ secrets.GITHUB_TOKEN }} |
| 53 |
publish_dir: ./out |
| 54 |
- name: Archive artifacts |
| 55 |
uses: actions/upload-artifact@v2 |
| 56 |
with: |
| 57 |
name: ${{ env.ZIP_NAME }} |
| 58 |
path: | |
| 59 |
fonts |
| 60 |
out |
| 61 |
outputs: |
| 62 |
zip_name: ${{ env.ZIP_NAME }} |
| 63 |
release: |
| 64 |
# only run if the commit is tagged... |
| 65 |
if: github.event_name == 'release' |
| 66 |
# ... and it builds successfully |
| 67 |
needs: |
| 68 |
- build |
| 69 |
runs-on: ubuntu-latest |
| 70 |
env: |
| 71 |
ZIP_NAME: ${{ needs.build.outputs.zip_name }} |
| 72 |
steps: |
| 73 |
- uses: actions/checkout@v2 |
| 74 |
- name: Download artefact files |
| 75 |
uses: actions/download-artifact@v2 |
| 76 |
with: |
| 77 |
name: ${{ env.ZIP_NAME }} |
| 78 |
path: ${{ env.ZIP_NAME }} |
| 79 |
- name: Zip files |
| 80 |
run: zip -r ${{ env.ZIP_NAME }}.zip ${{ env.ZIP_NAME }} |
| 81 |
- name: Upload binaries to release |
| 82 |
uses: svenstaro/upload-release-action@v2 |
| 83 |
with: |
| 84 |
repo_token: ${{ secrets.GITHUB_TOKEN }} |
| 85 |
file: ${{ env.ZIP_NAME }}.zip |
| 86 |
asset_name: ${{ env.ZIP_NAME }}.zip |
| 87 |
tag: ${{ github.ref }} |
| 88 |
overwrite: true |
| 89 |
body: "Production ready fonts" |