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

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

Back

"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