Skip to content

Commit

Permalink
Fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
khaledhosny committed Oct 31, 2024
1 parent f73b090 commit af0a5fc
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 63 deletions.
53 changes: 47 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Build

on: [push, pull_request]
Expand All @@ -9,15 +7,58 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: recursive
- name: Unshallow
run: git fetch --prune --unshallow --tags --force
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
- name: Build
run: make -B PYTHON=python
- name: Dist
run: make dist PYTHON=python
- name: Upload artifacts
if: github.ref_type == 'tag'
uses: actions/[email protected]
with:
name: dist
path: Qahiri-*.zip
if-no-files-found: error

deploy:
if: github.ref_type == 'tag'
needs: build
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Download artifacts
uses: actions/[email protected]
with:
path: dist

- name: Extract release notes from annotated tag message
run: |
make
# GH checkout action doesn't preserve tag annotations, we must fetch them
# https://github.com/actions/checkout/issues/290
git fetch --tags --force
echo "$(git tag -l --format='%(contents:body)' ${{ github.ref_name }})" > "${{ runner.temp }}/release_body.md"
echo "release_name=$(git tag -l --format='%(contents:subject)' ${{ github.ref_name }})" >> $GITHUB_ENV
- name: Publish
uses: softprops/action-gh-release@v1
with:
name: ${{ env.release_name }}
body_path: ${{ runner.temp }}/release_body.md
fail_on_unmatched_files: true
files: |
dist/*/*
52 changes: 26 additions & 26 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,44 +15,44 @@

NAME = Qahiri

MAKEFLAGS := -sr
SHELL = bash

CONFIG = docs/_config.yml
VERSION = $(shell grep "version:" $(CONFIG) | sed -e 's/.*.: "\(.*.\)".*/\1/')
DIST = $(NAME)-$(VERSION)
MAKEFLAGS := -sr
PYTHON := venv/bin/python3

SOURCEDIR = sources
SCRIPTDIR = scripts
FONTDIR = fonts
TESTDIR = tests
BUILDDIR = build

FONTS = $(FONTDIR)/$(NAME)-Regular.ttf
WOFF2 = $(FONTDIR)/$(NAME)-Regular.woff2
FONT = ${FONTDIR}/${NAME}-Regular.ttf

GLYPHSFILE = ${SOURCEDIR}/${NAME}.glyphspackage

export SOURCE_DATE_EPOCH ?= $(shell stat -c "%Y" ${GLYPHSFILE})

TAG = $(shell git describe --tags --abbrev=0)
VERSION = ${TAG:v%=%}
DIST = ${NAME}-${VERSION}


.SECONDARY:
.ONESHELL:
.PHONY: all dist

all: ttf web
ttf: $(FONTS)
.PHONY: all clean dist ttf

web: $(WOFF2)
cp $(WOFF2) docs/assets/fonts/
cp $(FONTS) docs/app/assets/fonts/
all: ttf
ttf: ${FONT}

%.ttf: $(SOURCEDIR)/$(NAME).glyphspackage $(CONFIG)
$(info   BUILD $(@F))
python $(SCRIPTDIR)/build.py $< $(VERSION) $@
${FONT}: ${GLYPHSFILE}
$(info   BUILD ${@F})
${PYTHON} ${SCRIPTDIR}/build.py $< ${VERSION} $@

%.woff2: %.ttf
$(info   WOFF2 $(@F))
python $(SCRIPTDIR)/buildwoff2.py $< $@
dist: ${FONT}
$(info   DIST ${DIST}.zip)
install -Dm644 -t ${DIST} ${FONT}
install -Dm644 -t ${DIST} {README,README-Arabic}.txt
install -Dm644 -t ${DIST} OFL.txt
zip -rq ${DIST}.zip ${DIST}

dist: all
$(info   DIST $(DIST).zip)
install -Dm644 -t $(DIST) $(FONTS)
install -Dm644 -t $(DIST) {README,README-Arabic}.txt
install -Dm644 -t $(DIST) OFL.txt
zip -rq $(DIST).zip $(DIST)
clean:
rm -rf ${BUILDDIR} ${FONT} ${SVG} ${DIST} ${DIST}.zip
31 changes: 0 additions & 31 deletions scripts/buildwoff2.py

This file was deleted.

0 comments on commit af0a5fc

Please sign in to comment.