Build package release #19
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build package release | |
on: | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
sudo apt-get update -y | |
sudo apt-get install git zip unzip curl jq -y | |
- name: Setup PHP with PECL extension | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '7.4' | |
extensions: "mbstring, gd, bcmath, bz2, json" | |
tools: composer | |
- name: Get composer cache directory | |
id: composer-cache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Install composer dependencies from source | |
run: composer install --prefer-dist --no-dev --no-progress --no-interaction --optimize-autoloader | |
- name: Get build info | |
id: build_info | |
run: | | |
BUILD_VERSION=$(grep -oPm1 "(?<=<version>)[^<]+" ./jmpdf.xml) | |
echo "TIMESTAMP=$(date +%s)" >> $GITHUB_OUTPUT | |
if [[ -n $BUILD_VERSION ]]; then | |
echo "VERSION=$BUILD_VERSION" >> $GITHUB_OUTPUT | |
else | |
echo "Failed to get package version" | |
exit 1 | |
fi | |
- name: Build release archive with fonts | |
run: | | |
export TERM=xterm | |
zip -r lib_jmpdf_with_fonts.zip libraries src config.php jmpdf.xml | |
- name: Removes all unnecessary fonts | |
run: composer clear-fonts | |
- name: Build release archive without fonts | |
run: | | |
export TERM=xterm | |
zip -r lib_jmpdf.zip libraries src config.php jmpdf.xml | |
- name: Draft release | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: | | |
lib_jmpdf.zip | |
lib_jmpdf_with_fonts.zip | |
tag_name: "build.${{ steps.build_info.outputs.TIMESTAMP }}" | |
name: "${{ steps.build_info.outputs.VERSION }}-build.${{ steps.build_info.outputs.TIMESTAMP }}" |