[TASK] Prepare release 1.12.0 #5
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: | | |
| { | |
| echo 'terReleaseNotes<<EOF' | |
| echo "https://github.com/${{ github.repository }}/releases/tag/${{ env.version }}" | |
| echo EOF | |
| } >> "$GITHUB_ENV" | |
| - name: Setup PHP 8.1 | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: 8.1 | |
| 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 --indent 4 '."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 | |
| # @todo Revert to release version when https://github.com/softprops/action-gh-release/issues/628 is fixed. | |
| uses: softprops/action-gh-release@da05d552573ad5aba039eaac05058a918a7bf631 | |
| #uses: softprops/action-gh-release@v2 | |
| if: ${{startsWith(github.ref, 'refs/tags/') }} | |
| with: | |
| name: "[RELEASE] ${{ env.version }}" | |
| 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 |