From 9a951589dcc2e2e605096c8057148807ee7cfa5d Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sat, 13 Feb 2021 09:38:34 +0100 Subject: [PATCH 1/6] Updated year in license --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 547f267a..2a381d83 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2016-2020 Alejandro Celaya +Copyright (c) 2016-2021 Alejandro Celaya Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From a2030b6c273160937b2ec05f781bce1386b72164 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sat, 13 Feb 2021 11:39:51 +0100 Subject: [PATCH 2/6] Updated to shlink-event-dispatcher 2.1 --- composer.json | 2 +- docker-compose.yml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 7dde5dcc..518d31bd 100644 --- a/composer.json +++ b/composer.json @@ -48,7 +48,7 @@ "ramsey/uuid": "^3.9", "shlinkio/shlink-common": "^3.5", "shlinkio/shlink-config": "^1.0", - "shlinkio/shlink-event-dispatcher": "^2.0", + "shlinkio/shlink-event-dispatcher": "^2.1", "shlinkio/shlink-importer": "^2.2", "shlinkio/shlink-installer": "dev-develop#c489d3f as 5.4", "shlinkio/shlink-ip-geolocation": "^1.5", diff --git a/docker-compose.yml b/docker-compose.yml index ba4558e4..ab7baf1f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,7 +3,7 @@ version: '3' services: shlink_nginx: container_name: shlink_nginx - image: nginx:1.17.10-alpine + image: nginx:1.19.6-alpine ports: - "8000:80" volumes: @@ -34,7 +34,7 @@ services: shlink_swoole_proxy: container_name: shlink_swoole_proxy - image: nginx:1.17.10-alpine + image: nginx:1.19.6-alpine ports: - "8002:80" volumes: @@ -120,7 +120,7 @@ services: shlink_mercure_proxy: container_name: shlink_mercure_proxy - image: nginx:1.17.10-alpine + image: nginx:1.19.6-alpine ports: - "8001:80" volumes: From ede7551856c77a40bb3e3b98863ec5618b4de3c1 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sat, 13 Feb 2021 12:56:41 +0100 Subject: [PATCH 3/6] Updated build script so that it allows building a dist file for non-swoole envs --- build.sh | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/build.sh b/build.sh index 16610a8b..c6abbc8a 100755 --- a/build.sh +++ b/build.sh @@ -1,35 +1,45 @@ #!/usr/bin/env bash set -e -if [[ "$#" -ne 1 ]]; then +if [ "$#" -lt 1 ] || [ "$#" -gt 2 ] || ([ "$#" == 2 ] && [ "$2" != "--no-swoole" ]); then echo "Usage:" >&2 - echo " $0 {version}" >&2 + echo " $0 {version} [--no-swoole]" >&2 exit 1 fi version=$1 -builtcontent="./build/shlink_${version}_dist" +noSwoole=$2 +phpVersion=$(php -r 'echo PHP_MAJOR_VERSION . "." . PHP_MINOR_VERSION;') +[[ $noSwoole ]] && swooleSuffix="" || swooleSuffix="_swoole" +distId="shlink${version}_php${phpVersion}${swooleSuffix}_dist" +builtContent="./build/${distId}" projectdir=$(pwd) [[ -f ./composer.phar ]] && composerBin='./composer.phar' || composerBin='composer' # Copy project content to temp dir echo 'Copying project files...' -rm -rf "${builtcontent}" -mkdir -p "${builtcontent}" -rsync -av * "${builtcontent}" \ +rm -rf "${builtContent}" +mkdir -p "${builtContent}" +rsync -av * "${builtContent}" \ --exclude=*docker* \ --exclude=Dockerfile \ --include=.htaccess \ --exclude-from=./.dockerignore -cd "${builtcontent}" +cd "${builtContent}" # Install dependencies echo "Installing dependencies with $composerBin..." +composerFlags="--optimize-autoloader --no-progress --no-interaction" ${composerBin} self-update -${composerBin} install --no-dev --optimize-autoloader --prefer-dist --no-progress --no-interaction +${composerBin} install --no-dev --prefer-dist $composerFlags -# Copy mezzio helper script to vendor (deprecated - Remove with Shlink 3.0.0) -cp "${projectdir}/bin/helper/mezzio-swoole" "./vendor/bin" +if [[ $noSwoole ]]; then + # If generating a dist not for swoole, uninstall mezzio-swoole + ${composerBin} remove mezzio/mezzio-swoole --with-all-dependencies --update-no-dev $composerFlags +else + # Copy mezzio helper script to vendor (deprecated - Remove with Shlink 3.0.0) + cp "${projectdir}/bin/helper/mezzio-swoole" "./vendor/bin" +fi # Delete development files echo 'Deleting dev files...' @@ -41,9 +51,9 @@ sed -i "s/%SHLINK_VERSION%/${version}/g" config/autoload/app_options.global.php # Compressing file echo 'Compressing files...' cd "${projectdir}"/build -rm -f ./shlink_${version}_dist.zip -zip -ry ./shlink_${version}_dist.zip ./shlink_${version}_dist +rm -f ./${distId}.zip +zip -ry ./${distId}.zip ./${distId} cd "${projectdir}" -rm -rf "${builtcontent}" +rm -rf "${builtContent}" echo 'Done!' From d9af0a5547a7c549bd9eb0beb3498ef13410432f Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sat, 13 Feb 2021 13:29:38 +0100 Subject: [PATCH 4/6] Improved publish-release workflow to generate files for all supported PHP versions and with/without swoole --- .github/workflows/publish-release.yml | 36 +++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 3047b4ee..bddaca9a 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -7,18 +7,36 @@ on: jobs: build: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 + strategy: + matrix: + php-version: ['7.4', '8.0'] + swoole: ['yes', 'no'] steps: - name: Checkout code uses: actions/checkout@v2 - - name: Use PHP 7.4 + - name: Use PHP uses: shivammathur/setup-php@v2 with: - php-version: '7.4' # Publish release with lowest supported PHP version + php-version: ${{ matrix.php-version }} tools: composer extensions: swoole-4.6.3 - - name: Generate release assets + - if: ${{ matrix.swoole == 'yes' }} run: ./build.sh ${GITHUB_REF#refs/tags/v} + - if: ${{ matrix.swoole == 'no' }} + run: ./build.sh ${GITHUB_REF#refs/tags/v} --no-swoole + - uses: actions/upload-artifact@v2 + with: + name: dist-files + path: build + + publish: + needs: ['build'] + runs-on: ubuntu-20.04 + steps: + - uses: actions/download-artifact@v2 + with: + path: build - name: Publish release with assets uses: docker://antonyurchenko/git-release:latest env: @@ -27,4 +45,12 @@ jobs: ALLOW_EMPTY_CHANGELOG: "true" with: args: | - build/shlink_*_dist.zip + build/shlink*_dist.zip + + delete-artifacts: + needs: ['publish'] + runs-on: ubuntu-20.04 + steps: + - uses: geekyeggo/delete-artifact@v1 + with: + name: dist-files From e3bf046c308d3ac421d67618125db396c56c88d9 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sat, 13 Feb 2021 13:44:52 +0100 Subject: [PATCH 5/6] Documented new system with multiple dist files --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 873f83ec..23f9e652 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ In order to run Shlink, you will need a built version of the project. There are The easiest way to install shlink is by using one of the pre-bundled distributable packages. - Go to the [latest version](https://github.com/shlinkio/shlink/releases/latest) and download the `shlink_x.x.x_dist.zip` file you will find there. + Go to the [latest version](https://github.com/shlinkio/shlink/releases/latest) and download the `shlink*_dist.zip` file that suits your needs. You will find one for every supported PHP version and with/without swoole integration. Finally, decompress the file in the location of your choice. @@ -57,9 +57,9 @@ In order to run Shlink, you will need a built version of the project. There are * Clone the project with git (`git clone https://github.com/shlinkio/shlink.git`), or download it by clicking the **Clone or download** green button. * Download the [Composer](https://getcomposer.org/download/) PHP package manager inside the project folder. - * Run `./build.sh 1.0.0`, replacing the version with the version number you are going to build (the version number is only used for the generated dist file). + * Run `./build.sh 1.0.0`, replacing the version with the version number you are going to build (the version number is used as part of the generated dist file name, and to set the value returned when running `shlink -V` from the command line). - After that, you will have a `shlink_x.x.x_dist.zip` dist file inside the `build` directory, that you need to decompress in the location fo your choice. + After that, you will have a dist file inside the `build` directory, that you need to decompress in the location of your choice. > This is the process used when releasing new shlink versions. After tagging the new version with git, the Github release is automatically created by a [GitHub workflow](https://github.com/shlinkio/shlink/actions?query=workflow%3A%22Publish+release%22), attaching the generated dist file to it. From 5cd5fb007191a42e5e0dcb7af3108e1605b984aa Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sat, 13 Feb 2021 13:49:53 +0100 Subject: [PATCH 6/6] Updated changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 78fe5104..c487575a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), and this * [#977](https://github.com/shlinkio/shlink/issues/977) Migrated from `laminas/laminas-paginator` to `pagerfanta/core` to handle pagination. * [#986](https://github.com/shlinkio/shlink/issues/986) Updated official docker image to use PHP 8. * [#1010](https://github.com/shlinkio/shlink/issues/1010) Increased timeout for database commands to 10 minutes. +* [#874](https://github.com/shlinkio/shlink/issues/874) Changed how dist files are generated. Now there will be two for every supported PHP version, with and without support for swoole. + + The dist files will have been built under the same PHP version they are meant to be run under, ensuring resolved dependencies are the proper ones. ### Deprecated * [#959](https://github.com/shlinkio/shlink/issues/959) Deprecated all command flags using camelCase format (like `--expirationDate`), adding kebab-case replacements for all of them (like `--expiration-date`).