Skip to content

Remove if-else - initializeHtmlPurifier (#1092) #387

Remove if-else - initializeHtmlPurifier (#1092)

Remove if-else - initializeHtmlPurifier (#1092) #387

Workflow file for this run

name: Build
on:
workflow_dispatch:
push:
branches:
- master
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
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-php${{ matrix.php-versions }}
- name: Install dependencies
run: composer install --prefer-dist --no-dev --optimize-autoloader --no-interaction
- name: Optimize vendor and static/js
run: php build/optimize_build.php
- name: Create archive
run: |
git archive --format=zip HEAD > Ilch-2.zip
zip -q -d Ilch-2.zip static/js/\* composer.json composer.lock CONTRIBUTING.md README.md
zip -q -r Ilch-2.zip vendor static/js
- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: ilch2-zip
path: |
Ilch-2.zip
- name: Upload archive to ilch.de
if: ${{ github.ref_name == 'master' }}
uses: wlixcc/SFTP-Deploy-Action@v1.2.4
with:
username: 'ilch2'
server: 'ilch.de'
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}
local_path: './Ilch-2.zip'
sftp_only: true
remote_path: '/versions/master.zip'
sftpArgs: '-o ConnectTimeout=5'
create-draft:
runs-on: ubuntu-latest
needs: [build]
if: ${{ github.ref_type == 'tag' }}
steps:
- name: Download a single artifact
uses: actions/download-artifact@v4
with:
name: ilch2-zip
- name: Prepare release
id: prepare-release
run: |
mv Ilch-2.zip Ilch-${{ github.ref_name }}.zip
echo "VERSION=${GITHUB_REF_NAME/v/}" >> $GITHUB_OUTPUT
- name: Create release draft
uses: ncipollo/release-action@v1
with:
artifacts: ${{ format('Ilch-{0}.zip', github.ref_name) }}
token: ${{ secrets.GITHUB_TOKEN }}
draft: true
name: ${{ format('Version {0}', steps.prepare-release.outputs.VERSION) }}