Build package release #2
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: '8.1' | |
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>)[^<]+" ./jinterventionimage.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 | |
run: | | |
export TERM=xterm | |
zip -r lib_jinterventionimage.zip libraries language src jinterventionimage.xml script.php | |
- name: Draft release | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: | | |
lib_jinterventionimage.zip | |
tag_name: "build.${{ steps.build_info.outputs.TIMESTAMP }}" | |
name: "${{ steps.build_info.outputs.VERSION }}-build.${{ steps.build_info.outputs.TIMESTAMP }}" |