Skip to content

Commit 64d4c41

Browse files
authored
Upgrade GitHub Actions and Python version in workflow
Updated the GitHub Actions workflow to use newer versions of actions and Python. Adjusted steps for building, testing, and deploying the font.
1 parent 7b18b48 commit 64d4c41

File tree

1 file changed

+96
-19
lines changed

1 file changed

+96
-19
lines changed

.github/workflows/build.yaml

Lines changed: 96 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,116 @@
11
name: Build font and specimen
22

3-
on: [push]
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-
- name: Upgrade pip
15-
run: python -m pip install -U pip
16-
- name: Install Linux dependencies
14+
python-version: "3.10"
15+
- name: Install sys tools/deps
1716
run: |
17+
sudo apt-get update
18+
sudo apt-get install ttfautohint
1819
sudo snap install yq
20+
- uses: actions/cache@v4
21+
with:
22+
path: ./venv/
23+
key: ${{ runner.os }}-venv-${{ hashFiles('**/requirements*.txt') }}
24+
restore-keys: |
25+
${{ runner.os }}-venv-
26+
- name: gen zip file name
27+
id: zip-name
28+
shell: bash
29+
# Set the archive name to repo name + "-assets" e.g "MavenPro-assets"
30+
run: echo "ZIP_NAME=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')-fonts" >> $GITHUB_ENV
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+
1945
- name: Build font
2046
run: make build
2147
- name: Check with fontbakery
2248
run: make test
2349
continue-on-error: true
24-
- name: Generate proofs
50+
- name: proof
2551
run: make proof
26-
- name: Gather
27-
run: |
28-
mkdir for-gh-pages
29-
mv fontbakery-report.html for-gh-pages
30-
mv out/* for-gh-pages
52+
- name: setup site
53+
run: cp scripts/index.html out/index.html
54+
- name: Deploy
55+
uses: peaceiris/actions-gh-pages@v4
56+
if: ${{ github.ref == 'refs/heads/main' }}
57+
with:
58+
github_token: ${{ secrets.GITHUB_TOKEN }}
59+
publish_dir: ./out
3160
- name: Archive artifacts
3261
uses: actions/upload-artifact@v4
3362
with:
34-
name: Artifacts
63+
name: ${{ env.ZIP_NAME }}
3564
path: |
36-
for-gh-pages
37-
- name: Remove temp folder
38-
run: |
39-
rm -rf for-gh-pages
65+
fonts
66+
out
67+
outputs:
68+
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+
76+
release:
77+
name: Create and populate release
78+
needs: build
79+
runs-on: ubuntu-latest
80+
if: contains(github.ref, 'refs/tags/')
81+
env:
82+
ZIP_NAME: ${{ needs.build.outputs.zip_name }}
83+
GH_TOKEN: ${{ github.token }}
84+
steps:
85+
- uses: actions/checkout@v4
86+
- name: Download font artefact files
87+
uses: actions/download-artifact@v4
88+
with:
89+
name: ${{ env.ZIP_NAME }}
90+
path: ${{ env.ZIP_NAME }}
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

0 commit comments

Comments
 (0)