Skip to content

2024/04/16#6

2024/04/16#6 #4

Workflow file for this run

# Builds fonts either when a prerelease version tag (e.g. v1.2-foo)
# is created, or when source is changed.
#
# When a version tag is created, a pre-release is automatically created.
#
# Otherwise, when source changes without a tag being created,
# the build artifacts are uploaded to github and saved for 1 day.
# They can be found at https://github.com/rsms/inter/actions/runs/RUNID
name: Build fonts
on:
push:
branches: [main]
paths:
- "src/**"
- "scripts/**"
- Makefile
- requirements.txt
tags:
- "v*"
pull_request:
branches: [main]
paths:
- "src/**"
- "scripts/**"
- Makefile
- requirements.txt
workflow_dispatch:
defaults:
run:
shell: bash
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install utilities
run: sudo apt-get install -y zip
- name: make init
run: make init
- name: Define version (tag)
if: startsWith(github.ref, 'refs/tags/v')
run: |
VERSION=${{ github.ref }}
VERSION=${VERSION:11} # refs/tags/v1.2.3 => 1.2.3
echo "NeoHanSans_version=$VERSION" >> $GITHUB_ENV
- name: Define version (branch)
if: ${{ ! startsWith(github.ref, 'refs/tags/v') }}
run: |
python scripts/get_ver.py
GITSHA=${{ github.sha }}
VERSION=$(cat version.txt)
echo "NeoHanSans_version=${VERSION}-${GITSHA:0:7}" >> $GITHUB_ENV
- name: make build
run: |
ZIP=NeoHanSans-${{ env.NeoHanSans_version }}.zip
echo "NeoHanSans_zip=$ZIP" >> $GITHUB_ENV
make zip
mv NeoHanSans.zip "$ZIP"
- name: Upload archive (unless tag)
if: ${{ ! startsWith(github.ref, 'refs/tags/v') }}
uses: actions/upload-artifact@v4
with:
name: "${{ env.NeoHanSans_version }}"
path: ${{ env.NeoHanSans_zip }}
retention-days: 1
- name: Create release (if tag)
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v2
with:
prerelease: true
name: "${{ env.NeoHanSans_version }}"
body: "This release was created automatically"
files: ${{ env.NeoHanSans_zip }}