Skip to content

Commit

Permalink
Automate releases
Browse files Browse the repository at this point in the history
  • Loading branch information
dscorbett committed Sep 15, 2024
1 parent b44b87b commit d6306cf
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 2 deletions.
31 changes: 29 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,16 @@
# limitations under the License.

name: Main workflow
on: push
on:
push:
workflow_dispatch:
inputs:
release:
description: Run a release build
type: boolean
next-version:
description: Next version number (optional)
type: string
permissions:
contents: read
env:
Expand Down Expand Up @@ -207,7 +216,7 @@ jobs:
run: |
. ${{ matrix.build-venv }}-venv/bin/activate
make clean
make -B -j 'CHARSET=${{ matrix.charset }}' 'COVERAGE=${{ matrix.coverage }}' ${{ matrix.charset == 'noto' && 'NOTO=1' || '' }} 'UNJOINED=${{ matrix.unjoined }}' 'PYTHONOPTIMIZE=${{ matrix.optimize }}'
make -B -j 'CHARSET=${{ matrix.charset }}' 'COVERAGE=${{ matrix.coverage }}' ${{ matrix.charset == 'noto' && 'NOTO=1' || '' }} 'PYTHONOPTIMIZE=${{ matrix.optimize }}' ${{ inputs.release && 'RELEASE=1' || '' }} 'UNJOINED=${{ matrix.unjoined }}'
- name: Test
if: matrix.coverage == ''
run: |
Expand Down Expand Up @@ -288,3 +297,21 @@ jobs:
path: fonts
- name: Compare the fonts built with `PYTHONOPTIMIZE`
run: diff -qrs fonts fonts-PYTHONOPTIMIZE
release:
permissions:
contents: write
runs-on: ubuntu-22.04
if: ${{ inputs.release }}
needs:
- compare-PYTHONOPTIMIZE
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Tag the release commit and bump the version number
run: |
git config --local user.email '41898282+github-actions[bot]@users.noreply.github.com'
git config --local user.name 'github-actions[bot]'
make ${{ inputs.next-version != '' && format('''NEXT_VERSION={0}''', inputs.next-version) || '' }} release
git push --follow-tags
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ unexport CHARSET
SUFFIXES = $(VALID_SUFFIXES)
TALL_TEXT = 𛰋𛱚𛰚‌𛰆𛱁𛰚𛰊
HB_VERSION = 9.0.0
NEXT_VERSION = $$(python -c 'v = "$(VERSION)".split("."); print(f"{v[0]}.{int(v[1]) + 1}")')

CHECK_ARGS = $(if $(filter testing,$(CHARSET)),,--incomplete)
FONT_FILE_NAME = $(subst $(eval ) ,,$(FONT_FAMILY_NAME))
Expand Down Expand Up @@ -215,6 +216,17 @@ $(patsubst %.in,%.txt,$(wildcard *requirements.in)): %requirements.txt: %require
printf '%s\n#\n%s\n' "$$(sed -n '1,/^$$/p' $<)" "$$(cat $@)" >$@
-git --no-pager diff $@

.PHONY: release
release: RELEASE=1
release:
test -z "$$(git status --porcelain --untracked-files=no)"
grep "^[[:space:]]*VERSION[[:space:]]*=[[:space:]]*$(VERSION)[[:space:]]*$$" $(lastword $(MAKEFILE_LIST))
git tag --annotate --message='Release $(FONT_FAMILY_NAME) $(VERSION).0' $(FONT_FILE_NAME)-v$(VERSION).0
sed -i.bak "/^[[:space:]]*VERSION[[:space:]]*=[[:space:]]*$(VERSION)[[:space:]]*$$/s/=.*/= $(NEXT_VERSION)/" $(lastword $(MAKEFILE_LIST))
$(RM) $(lastword $(MAKEFILE_LIST)).bak
git add $(lastword $(MAKEFILE_LIST))
git commit --message "Prepare for $(FONT_FAMILY_NAME) $(NEXT_VERSION).0"

.PHONY: sync-noto
sync-noto:
if [ ! -d notofonts/duployan ]; then git clone [email protected]:notofonts/duployan.git notofonts/duployan; fi
Expand Down
4 changes: 4 additions & 0 deletions docs/developer-documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ Makefile has many available targets. The main ones are:
* `hb-shape` and `hb-view`: Build HarfBuzz’s command-line utilities.
* `requirements.txt` and `dev-requirements.txt`: Update `*requirements.txt`
based on `*requirements.in`.
* `release`: Create a Git tag for the current commit, then a new commit updating
to the next version number.
* `sync-noto`: Prepare to sync the downstream Noto repository with changes in
this repository. (Some manual work is still required.)

Expand All @@ -99,6 +101,8 @@ These targets are affected by various variables:
whether to enforce a minimum coverage percentage when testing.
* `HB_VERSION`: The version of HarfBuzz to build when building its command-line
utilities.
* `NEXT_VERSION`: The next version number. By default, the next version number
increments the minor part of `VERSION`.

All the fonts for a given character set variant should share the same vertical
metrics. When building the fonts, preliminary versions of all of the fonts with
Expand Down

0 comments on commit d6306cf

Please sign in to comment.