Automatic Release TYPO3 Extensions to TER (Using Github Actions)

Are you a TYPO3 Github lover? And, Are you looking for automatic release TYPO3 extensions to TER? You landed in the correct place; In this micro TYPO3 blog, you will learn how to set up TYPO3 Github Actions.

Automatic Release TYPO3 Extensions to TER (Using Github Actions)

Are you a TYPO3 Github lover? And, Are you looking for automatic release TYPO3 extensions to TER? You landed in the correct place; In this micro TYPO3 blog, you will learn how to set up TYPO3 Github Actions.

TYPO3 community loves Github; Most of the developer’s TYPO3 Opensource extensions are developed and maintained at Github. One pain for the developer to manually release their TYPO3 extension to TER (TYPO3 Extension Repository) at https://extensions.typo3.org/ In this guide, you will learn how to release and deploy your TYPO3 extension to TER automatically.

I recommend reading one of my popular TYPO3 articles 8 Ways to Publish Your TER TYPO3 Extensions.

My dear TYPO3 reader, before we start, as you know, my TYPO3 ritual - Let’s appreciate the work of the fantastic TYPO3 community.

 

I want to dedicate this blog to the TYPO3 people who worked very hard at TER (for token access), TYPO3 tailor (for automatic deployment), of course, Github guys, too fantastic Github Action tool as well. Also, thanks to the TYPO3 people who provided automated deployment third-party tool until now.

Why TYPO3 Github Actions?

Most of the Open Source community uses Github to develop and maintain their projects. In late 2019, Github launched their great CI/CD approach with Github actions. Now the Open Source community does not require third-party deployment tools like Travis.

TYPO3 community also primarily uses Github to maintain TYPO3 core and extensions projects. To save time and effort, every TYPO3 developer who uses Github should use Github actions to automatically deploy their TYPO3 extensions project to TER (TYPO3 Extensions Repository).

Introduce to TYPO3 Tailor

Benni Mack (TYPO3 Core Leader) initiated the TYPO3 Tailor project on 13th Nov 2020. Tailor is a CLI application to help you maintain your extensions. Tailor talks with the TER REST API and enables you to register new keys, update extension information and publish new versions to the extension repository.

What's the Goal with TYPO3 Github Actions?

The goal is straightforward; here is the list of actions.

  1. You are done with your changes and pushed your code to the TYPO3 Github repository.
  2. Release a new tag of your TYPO3 Github repository.
  3. Action: Automatically release your TYPO3 extension to TER.

Step-by-step Guide to TYPO3 Github Actions

Here, I want to guide you through releasing your TYPO3 extensions to TER using Github actions automatically.

Step 1. Login to Extensions.TYPO3.org

Go to https://extensions.typo3.org/ Either register your new account or log in with your existing account.

Step 2. Get Your Access Tokens

Click on “My Access Tokens” https://extensions.typo3.org/my-access-tokens/create Let’s create an access token;

  • Name: Enter access token name.
  • Expiration date: You may define max 1-year expiry date
  • Scopes: You can set read and write access
  • Extensions: Be careful with allowing your particular extensions.
  • Password: As confirmation, you should enter your account’s password.

Step 3. Save Your TYPO3 Secret

Keep saving your Access token, which TER generates.

Step 4. Create Github Secrets Variable

Before setting up TYPO3 Github Actions, you will need to create a Github secret variable used in Github actions.

  • Login to https://github.com/
  • Open your particular TYPO3 repository.
  • Go to Settings > Secrets > Click on “New Repository Secret.”
  • Create the following TYPO3 secret variables.
  • TYPO3_EXTENSION_KEY (your TYPO3 extension key)
  • TYPO3_REPOSITORY_URL (your TYPO3 Github repository URL)
  • TYPO3_API_USERNAME (your username of extensions.typo3.org)
  • TYPO3_API_PASSWORD (your password of extensions.typo3.org)
  • TYPO3_API_TOKEN (from above Step 3)

Step 5. Let’s Configure TYPO3 Github Actions

It’s time to integrate TYPO3 Github Actions into your TYPO3 Github repository.

  • Go to your TYPO3 Github repository.
  • Create “.github/workflows/ter-release.yml” folder and file.
  • Add below code to a ter-release.yml file.
// ter-release.yml
name: TYPO3 Extension TER Release
on:
  push:
    tags:
      - '*'
jobs:
  ter-release:
    name: TYPO3 TER Release
    runs-on: ubuntu-latest
    env:
      TYPO3_EXTENSION_KEY: ${{ secrets.TYPO3_EXTENSION_KEY }}
      TYPO3_REPOSITORY_URL: ${{ secrets.TYPO3_REPOSITORY_URL }}
      TYPO3_API_TOKEN: ${{ secrets.TYPO3_API_TOKEN }}
      TYPO3_API_USERNAME: ${{ secrets.TYPO3_API_USERNAME }}
      TYPO3_API_PASSWORD: ${{ secrets.TYPO3_API_PASSWORD }}

    steps:
      - name: Grab new version
        id: get_version
        run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
      - name: Configure PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: '7.4'
          extensions: intl, mbstring, xml, soap, zip, curl
      - name: Install TYPO3 Tailor Extension
        run: composer global require typo3/tailor --prefer-dist --no-progress --no-suggest
      - name: Release EXT:${{ env.TYPO3_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.TYPO3_REPOSITORY_URL }}/archive/${{ steps.get_version.outputs.VERSION }}.zip --comment="Successfully release new version ${{ steps.get_version.outputs.VERSION }} - see changelog at ${{ env.TYPO3_REPOSITORY_URL }}"

Step 6. Done, Ready To Next Release!

Now everything is configured and ready for the next release. Now, whenever you release a new tag from your Github repository, it will automatically release and deploy your TYPO3 extension to TER (Extensions.TYPO3.org).

Released TYPO3 Extension at TER

Status of TYPO3 Release Github Actions

Log of TYPO3 Release Github Actions

Closure!

Thanks for reading my article. I hope you like and learn about TYPO3 + Github Actions.

Of course, there are many other Git tools available, but I recommend using Github for your Opensource TYPO3 projects. As you can see in this article, it’s so easy to release and deploy your TYPO3 extension to TER.

What’s your favorite way to auto-deploy your TYPO3 extension to TER? Do you have any problems or questions about TYPO3 Github Actions? I’ll be happy to answer the comment box.
Have a Happy TYPO3 Release

Post a Comment

×
Captcha Code Can't read the image? Click here to refresh
  • user
    Eric Theissen 2021-06-08 at 3:00 pm
    Great article on automatic TYPO3 Extension Updates Sanjay! Thanks for publishing