nerd-fonts/.github/workflows/release.yml

269 lines
9.2 KiB
YAML
Raw Normal View History

# triggers a release or a release candidate based on the version defined in package.json
name: Release
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
paths-ignore:
- 'images/**'
- '**.md'
- '.all-contributorsrc'
- 'chocolatey/**'
- 'bin/scripts/lib/**'
- 'Dockerfile'
- 'install.ps1'
- 'install.sh'
- 'LICENSE'
- 'package**'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
2021-11-26 15:46:46 +01:00
setup-fonts-matrix:
runs-on: ubuntu-latest
steps:
# Faster version instead of - uses: actions/checkout@v3
- uses: Bhacaz/checkout-files@v2
with:
files: package.json bin/scripts/get-font-names-from-json.sh bin/scripts/lib/fonts.json
branch: ${{ github.head_ref || github.ref_name }}
- name: Determine font matrix
2021-11-26 15:46:46 +01:00
id: set-matrix
run: |
cd -- $GITHUB_WORKSPACE/bin/scripts/
chmod u+x get-font-names-from-json.sh
2021-11-26 15:46:46 +01:00
fontNames=$(./get-font-names-from-json.sh)
2021-11-26 16:08:59 +01:00
echo "${fontNames}"
2021-11-26 15:46:46 +01:00
echo "::set-output name=matrix::${fontNames}"
2021-11-26 16:08:59 +01:00
echo ${{ steps.set-matrix.outputs.matrix }}
2021-11-26 15:46:46 +01:00
- name: Fetch release version
id: rel_ver
run: |
cd -- "$GITHUB_WORKSPACE"
echo "Contents of package.json:"
cat package.json
RELEASE_TAG_VERSION=$(cat package.json \
| grep version \
| head -1 \
| awk -F: '{ print $2 }' \
| sed 's/[ ",]//g')
echo "RELEASE_TAG_VERSION=$RELEASE_TAG_VERSION" >> $GITHUB_ENV
echo "::set-output name=val::$RELEASE_TAG_VERSION"
- name: Determine candidate status
id: rel_can
run: |
[[ "$RELEASE_TAG_VERSION" == *"-RC"* ]] && echo "::set-output name=val::true" || echo "::set-output name=val::false"
2021-11-26 15:46:46 +01:00
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
rel_version: ${{ steps.rel_ver.outputs.val }}
rel_candidate: ${{ steps.rel_can.outputs.val }}
2021-11-26 15:46:46 +01:00
# Workflow to build and install dependencies
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
2021-11-26 16:08:59 +01:00
needs: setup-fonts-matrix
env:
GITHUB_ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_TAG_VERSION: ${{ needs.setup-fonts-matrix.outputs.rel_version }}
RELEASE_CANDIDATE: ${{ needs.setup-fonts-matrix.outputs.rel_candidate }}
2021-11-26 15:46:46 +01:00
strategy:
matrix:
font: ${{fromJson(needs.setup-fonts-matrix.outputs.matrix)}}
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- name: Check release variables
run: |
echo "$RELEASE_TAG_VERSION"
echo "Candidate: $RELEASE_CANDIDATE"
# Install and setup Dependencies
2021-11-26 15:46:46 +01:00
# @TODO cache the next 4 steps with actions/cache or upload
- name: Setup core dependencies
run: |
sudo apt update -y -q
sudo apt install software-properties-common -y -q
sudo apt install python3-fontforge -y -q
# Ubuntu 20.04 has only fontforge release 2020, but there are some vital bugfixes in the 2022 release
# This can be replaced with the ordinary apt package when Ubuntu updates, probably with 22.10?
- name: Fetch FontForge
run: |
curl -L "https://github.com/fontforge/fontforge/releases/download/20220308/FontForge-2022-03-08-582bd41-x86_64.AppImage" \
--output fontforge
chmod u+x fontforge
echo Try appimage
./fontforge --version
export PATH=`pwd`:$PATH
echo "PATH=$PATH" >> $GITHUB_ENV
echo Try appimage with path
fontforge --version
# It is unclear what this has been needed for
- name: Setup additional dependencies
if: false
run: |
pip install fonttools --quiet
# It is unclear what this has been needed for
- name: Build FreeType from source
if: false
run: |
wget http://downloads.sourceforge.net/project/freetype/freetype2/2.7/freetype-2.7.tar.gz --quiet
tar -zxf freetype-2.7.tar.gz
cd freetype-2.7
./configure
make --quiet
sudo make install --quiet
# It is unclear what this has been needed for
- name: Build Harfbuzz from source
if: false
run: |
wget http://www.freedesktop.org/software/harfbuzz/release/harfbuzz-1.3.4.tar.bz2 --quiet
tar -xjf harfbuzz-1.3.4.tar.bz2
cd harfbuzz-1.3.4
./configure
make --quiet
sudo make install --quiet
- name: Verify setup
run: |
fontforge --version
fontforge --version 2>&1 | grep libfontforge | awk '{print $NF}'
- name: Bump version for source files
run: |
cd -- "$GITHUB_WORKSPACE/bin/scripts"
./version-bump.sh "$RELEASE_TAG_VERSION"
2021-12-31 17:11:51 +01:00
- name: Standardize the readme files
run: |
cd -- "$GITHUB_WORKSPACE/bin/scripts"
2021-11-26 15:46:46 +01:00
./standardize-and-complete-readmes.sh "${{ matrix.font }}"
- name: Patch all the variations of the font family
run: |
cd -- "$GITHUB_WORKSPACE/bin/scripts"
fontforge --script `pwd`/../../font-patcher --version
./gotta-patch-em-all-font-patcher\!.sh "/${{ matrix.font }}"
- name: Generate fontconfig and casks
run: |
cd -- "$GITHUB_WORKSPACE/bin/scripts"
./generate-fontconfig.sh
2021-11-26 15:46:46 +01:00
./generate-casks.sh "${{ matrix.font }}"
- name: Archive font package zip files
run: |
cd -- "$GITHUB_WORKSPACE/bin/scripts"
./archive-fonts.sh "${{ matrix.font }}"
- name: Upload zip file archive for release
uses: softprops/action-gh-release@v0.1.14
with:
prerelease: ${{ env.RELEASE_CANDIDATE != 'false' }}
tag_name: ${{ env.RELEASE_TAG_VERSION }}
files: archives/*
- name: Upload patched fonts as artifacts
uses: actions/upload-artifact@v2
with:
name: patched-fonts
# adding multiple paths (i.e. LICENSE) is a workaround to get a least common ancestor
# of the root directory for artifact path purposes
2022-01-01 19:23:38 +01:00
path: |
patched-fonts/${{ matrix.font }}
LICENSE
release-font-patcher:
name: Archive font patcher and add to release
needs: [ setup-fonts-matrix, build ]
2022-01-03 12:27:10 +01:00
env:
GITHUB_ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_TAG_VERSION: ${{ needs.setup-fonts-matrix.outputs.rel_version }}
RELEASE_CANDIDATE: ${{ needs.setup-fonts-matrix.outputs.rel_candidate }}
2022-01-03 12:27:10 +01:00
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Bump version for source files
run: |
cd -- "$GITHUB_WORKSPACE/bin/scripts"
./version-bump.sh "$RELEASE_TAG_VERSION"
- name: Archive font-patcher script for release
run: |
cd -- "$GITHUB_WORKSPACE/bin/scripts"
./archive-font-patcher.sh
- name: Upload font-patcher archive for release
uses: softprops/action-gh-release@v0.1.14
with:
prerelease: ${{ env.RELEASE_CANDIDATE != 'false' }}
tag_name: ${{ env.RELEASE_TAG_VERSION }}
files: archives/*
commit:
name: Commit and push patched fonts to the repo
needs: [ setup-fonts-matrix, build ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Prepare repo (clear out old and obsolete fonts)
run: |
cd -- "$GITHUB_WORKSPACE/patched-fonts"
find . -name "*.[to]tf" -exec rm {} \;
- name: Download patched fonts from build
id: download-patched-fonts
uses: actions/download-artifact@v2
with:
name: patched-fonts
path: .
- name: Bump version for source files
env:
RELEASE_TAG_VERSION: ${{ needs.setup-fonts-matrix.outputs.rel_version }}
RELEASE_CANDIDATE: ${{ needs.setup-fonts-matrix.outputs.rel_candidate }}
run: |
cd -- "$GITHUB_WORKSPACE/bin/scripts"
./version-bump.sh "$RELEASE_TAG_VERSION"
- name: Commit version bump changes
# If there are no changes (i.e. we already have that bump commit from a previous run)
# the git commit will fail as empty commit (that we do not explicitely allow here),
# and the action fails silently (i.e. without stopping the job).
# This means there will be only one commit in the repo for each version tag change,
# regardless of how often we run the release CI.
uses: EndBug/add-and-commit@v9
with:
add: "['font-patcher', 'bin/scripts']"
message: Bump release version
committer_name: GitHub Actions
committer_email: 41898282+github-actions[bot]@users.noreply.github.com
- name: Commit patched fonts back to repo
uses: EndBug/add-and-commit@v9
with:
add: 'patched-fonts'
message: Rebuilds patched fonts
committer_name: GitHub Actions
committer_email: 41898282+github-actions[bot]@users.noreply.github.com