Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Auto-release new TYPO3 extensions from github to TER (TYPO3 Extension Repository) when they are tagged via REST API
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.
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 for some more help on this).
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 some more 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)
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) That's it :)
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 in extension lux: https://github.com/in2code-de/lux
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 }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment