1
1
name : Build font and specimen
2
2
3
- on : [ push, release]
3
+ on : push
4
4
5
5
jobs :
6
6
build :
7
+ name : Build and test
7
8
runs-on : ubuntu-latest
8
9
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
12
13
with :
13
- python-version : 3.8
14
+ python-version : " 3.10 "
14
15
- name : Install sys tools/deps
15
16
run : |
16
17
sudo apt-get update
17
18
sudo apt-get install ttfautohint
18
19
sudo snap install yq
19
- - uses : actions/cache@v2
20
+ - uses : actions/cache@v4
20
21
with :
21
22
path : ./venv/
22
23
key : ${{ runner.os }}-venv-${{ hashFiles('**/requirements*.txt') }}
23
24
restore-keys : |
24
25
${{ 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
26
- name : gen zip file name
35
27
id : zip-name
36
28
shell : bash
37
29
# Set the archive name to repo name + "-assets" e.g "MavenPro-assets"
38
30
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
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
+
51
45
- name : Build font
52
46
run : make build
53
47
- name : Check with fontbakery
@@ -58,44 +52,65 @@ jobs:
58
52
- name : setup site
59
53
run : cp scripts/index.html out/index.html
60
54
- name : Deploy
61
- uses : peaceiris/actions-gh-pages@v3
55
+ uses : peaceiris/actions-gh-pages@v4
62
56
if : ${{ github.ref == 'refs/heads/main' }}
63
57
with :
64
58
github_token : ${{ secrets.GITHUB_TOKEN }}
65
59
publish_dir : ./out
66
60
- name : Archive artifacts
67
- uses : actions/upload-artifact@v2
61
+ uses : actions/upload-artifact@v4
68
62
with :
69
63
name : ${{ env.ZIP_NAME }}
70
64
path : |
71
65
fonts
72
66
out
73
67
outputs :
74
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
+
75
76
release :
76
- # only run if the commit is tagged...
77
- if : github.event_name == 'release'
78
- # ... and it builds successfully
79
- needs :
80
- - build
77
+ name : Create and populate release
78
+ needs : build
81
79
runs-on : ubuntu-latest
80
+ if : contains(github.ref, 'refs/tags/')
82
81
env :
83
82
ZIP_NAME : ${{ needs.build.outputs.zip_name }}
83
+ GH_TOKEN : ${{ github.token }}
84
84
steps :
85
- - uses : actions/checkout@v2
86
- - name : Download artefact files
87
- uses : actions/download-artifact@v2
85
+ - uses : actions/checkout@v4
86
+ - name : Download font artefact files
87
+ uses : actions/download-artifact@v4
88
88
with :
89
89
name : ${{ env.ZIP_NAME }}
90
90
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"
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