[RELEASE] 4.5.2 #15
Workflow file for this run
This file contains hidden or 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: publish | |
| on: | |
| push: | |
| tags: | |
| - '*' | |
| jobs: | |
| publish: | |
| name: Ensure GitHub Release with extension TER artifact and publishing to TER | |
| if: startsWith(github.ref, 'refs/tags/') | |
| runs-on: ubuntu-latest | |
| env: | |
| TYPO3_API_TOKEN: ${{ secrets.TYPO3_API_TOKEN }} | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Verify tag | |
| run: | | |
| if ! [[ ${{ github.ref }} =~ ^refs/tags/[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$ ]]; then | |
| echo "ERR: Invalid publish version tag: ${{ github.ref }}" | |
| exit 1 | |
| fi | |
| - name: Get version | |
| id: get-version | |
| run: echo "version=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV | |
| - name: Get extension key | |
| id: get-extension-key | |
| run: | | |
| echo "DETECTED_EXTENSION_KEY=$(cat composer.json | jq -r '.extra."typo3/cms"."extension-key"' )" >> "$GITHUB_ENV" | |
| - name: Get comment | |
| id: get-comment | |
| run: | | |
| readonly local releaseCommentPrependBody="$( git tag -l ${{ env.version }} --format '%(contents)' )" | |
| if (( $(grep -c . <<<"${releaseCommentPrependBody// }") > 1 )); then | |
| { | |
| echo 'releaseCommentPrependBody<<EOF' | |
| echo "$releaseCommentPrependBody" | |
| echo EOF | |
| } >> "$GITHUB_ENV" | |
| fi | |
| { | |
| echo 'terReleaseNotes<<EOF' | |
| echo "https://github.com/web-vision/deepltranslate-core/tag/${{ env.version }}" | |
| echo EOF | |
| } >> "$GITHUB_ENV" | |
| # Using minimum supported PHP version is essential to ship bundled TER vendor package | |
| # compatible to the minimum version - otherwise we will have an issue. | |
| - name: Setup PHP 7.4 ( wv_deepltranslate 4.x ) | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: 7.4 | |
| extensions: intl, mbstring, json, zip, curl | |
| tools: composer:v2 | |
| - name: Prepare vendor folder and autoload configuration for TER upload | |
| shell: bash | |
| run: | | |
| rm -rf vendor composer.lock composer.json.orig composer.json.pretty \ | |
| && mv composer.json composer.json.orig \ | |
| && composer init -n \ | |
| --type=project \ | |
| --license='GPL-2.0-or-later' \ | |
| --name=release/draft \ | |
| --description empty \ | |
| --author='release' \ | |
| && composer config allow-plugins.php-http/discovery true \ | |
| && composer require "deeplcom/deepl-php":"$( cat composer.json.orig | jq -r '.require."deeplcom/deepl-php"' )" \ | |
| && rm -rf composer.lock \ | |
| vendor/composer \ | |
| vendor/nyholm \ | |
| vendor/php-http/multipart-stream-builder \ | |
| vendor/psr \ | |
| vendor/symfony \ | |
| vendor/autoload.php \ | |
| vendor/bin \ | |
| && cat <<< $(jq '."autoload"."psr-4" += {"DeepL\\": "vendor/deeplcom/deepl-php/src", "Http\\Discovery\\": "vendor/php-http/discovery/src"}' composer.json.orig) > composer.json.pretty \ | |
| && rm -rf composer.json \ | |
| && mv composer.json.pretty composer.json \ | |
| && rm -rf composer.json.orig | |
| - name: Install tailor | |
| run: composer global require typo3/tailor --prefer-dist --no-progress --no-suggest | |
| # Note that step will fail when `env.version` does not match the `ext_emconf.php` version. | |
| - name: Create local TER package upload artifact | |
| env: | |
| # See https://github.com/TYPO3/tailor?tab=readme-ov-file#exclude-paths-from-packaging | |
| TYPO3_EXCLUDE_FROM_PACKAGING: Build/tailor/ExcludeFromPackaging.php | |
| run: | | |
| php ~/.composer/vendor/bin/tailor create-artefact ${{ env.version }} ${{ env.DETECTED_EXTENSION_KEY }} | |
| # Note that when release already exists for tag, only files will be uploaded and lets this acting as a | |
| # fallback to ensure that a real GitHub release is created for the tag along with extension artifacts. | |
| - name: Create release and upload artifacts in the same step | |
| uses: softprops/action-gh-release@v2 | |
| if: ${{startsWith(github.ref, 'refs/tags/') }} | |
| with: | |
| name: "[RELEASE] ${{ env.version }}" | |
| body: "${{ env.releaseCommentPrependBody }}" | |
| generate_release_notes: true | |
| files: | | |
| tailor-version-artefact/${{ env.DETECTED_EXTENSION_KEY }}_${{ env.version }}.zip | |
| LICENSE | |
| fail_on_unmatched_files: true | |
| - name: Publish to TER | |
| run: | | |
| php ~/.composer/vendor/bin/tailor ter:publish --comment "${{ env.terReleaseNotes }}" ${{ env.version }} \ | |
| --artefact=tailor-version-artefact/${{ env.DETECTED_EXTENSION_KEY }}_${{ env.version }}.zip |