For coders TYPO3 Tech Corner

[GITHUB] Auto-release new TYPO3 extensions from github to TER

[GITHUB] Auto-release new TYPO3 extensions from github to TER

Github actions gives you the possibility to run some code after a special trigger (e.g. a push into a repo) is recognized. This can be used for running tests or - in our case - to deploy the software to TYPO3 TER when a new tag is pushed.

By the way, this works much easier than you might think:

1) First of all, you should login on extensions.typo3.org and create some access token (API Token) to use the new REST API of typo3.org to publish your extensions (see https://github.com/TYPO3/tailor#prerequisites)

2) After that you can add three secret tokens in your github repository (see https://docs.github.com/en/free-pro-team@latest/actions/reference/encrypted-secrets#creating-encrypted-secrets-for-an-environment for details):

TYPO3_API_USERNAME (your username for FE-login on typo3.org)
TYPO3_API_PASSWORD (your password for FE-login on typo3.org)
TYPO3_API_TOKEN (see 1 above)

Those secrets can be used as environment variable now.

3) Just add .github/workflows/ter-release.yml (see below) to your repository. Update line 13 and 14 with your configuration.

4) Done :)

ter-release.yml:

name: TER release on: push: tags: - '*' jobs: ter-release: name: TER release runs-on: ubuntu-latest env: TYPO3_EXTENSION_KEY: 'lux' REPOSITORY_URL: 'https://github.com/in2code-de/lux' TYPO3_API_TOKEN: ${{ secrets.TYPO3_API_TOKEN }} TYPO3_API_USERNAME: ${{ secrets.TYPO3_API_USERNAME }} TYPO3_API_PASSWORD: ${{ secrets.TYPO3_API_PASSWORD }} steps: - name: Get the version id: get_version run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} - name: Setup PHP uses: shivammathur/setup-php@v2 with: php-version: '7.4' extensions: intl, mbstring, xml, soap, zip, curl - name: Install EXT:tailor run: composer global require typo3/tailor --prefer-dist --no-progress --no-suggest - name: Upload EXT:${{ env.EXTENSION_KEY }} as ${{ steps.get_version.outputs.VERSION }} to TER run: php ~/.composer/vendor/bin/tailor ter:publish ${{ steps.get_version.outputs.VERSION }} --artefact=${{ env.REPOSITORY_URL }}/archive/${{ steps.get_version.outputs.VERSION }}.zip --comment="New release of version ${{ steps.get_version.outputs.VERSION }} - see details, changelog and documentation on ${{ env.REPOSITORY_URL }}"

Inspired from:
https://github.com/TYPO3/tailor/blob/main/README.md
https://www.felixnagel.com/blog/artikel/2020/06/23/automated-typo3-ter-releases-using-github-actions/

Used (e.g.) in extension lux:

https://github.com/in2code-de/lux

"Code faster, look at the time" - does this sound familiar to you?

How about time and respect for code quality? Working in a team? Automated tests?

Join us

Lesson cancellation - and now? New portal for the Bavarian school system.

For the Bavarian school system, we developed a new web app based on an existing but very outdated portal. The portal reports lesson cancellations throughout Bavaria and registered users are informed...

Go to news

SQL: Show all tables sorted by size in descending order

Lately I've been using the SQL command more often to find out which tables in the TYPO3 database are the largest. I've published the snippet once.

Go to news

TYPO3 12 with CKEditor 5: Styles in a single selection

If you set a link in the RTE in TYPO3, you may have to choose between different link classes, for example to create buttons in the frontend. What's new in TYPO3 12 is that you can select not just one...

Go to news

Null-Safe Operator in the TYPO3 area

With the introduction of PHP8, problems with undefined arrays or variables in general can arise in many places. Here are a few examples and simple solutions.

Go to news

Delete the first/last lines of a (SQL) file

There isn't much to say about the following commands. Sometimes it can be useful to delete the first (or last) X lines from a file. And if the file is too large to open with a conventional program, a...

Go to news

b13/container: Add and modify child elements in edit view

Unlike gridelements, you cannot manage the child elements in the B13 Container extension when you open the container in the editing view. I would be happy to show you how you can quickly install this...

Go to news