Skip to content

[TASK] Prepare release 5.1.2 #18

[TASK] Prepare release 5.1.2

[TASK] Prepare release 5.1.2 #18

Workflow file for this run

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 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/fgtclb/academic-persons/releases/tag/${{ env.version }}"
echo EOF
} >> "$GITHUB_ENV"
echo "DETECTED_EXTENSION_KEY=$(cat composer.json | jq -r '.extra."typo3/cms"."extension-key"' )" >> "$GITHUB_ENV"
- name: Setup PHP 7.4 ( wv_deepltranslate 4.x )
if: github.event.base_ref == 'refs/heads/4'
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
extensions: intl, mbstring, json, zip, curl
tools: composer:v2
- name: Setup PHP 8.1 ( deepltranlsate-core 5.x )
if: github.event.base_ref == 'refs/heads/main'
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
extensions: intl, mbstring, json, zip, curl
tools: composer:v2
- 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 }}"
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