astehlik/typo3-extension-tinyurls

View on GitHub
.github/workflows/publish.yml

Summary

Maintainability
Test Coverage
---
name: Publish to TER

on:
  push:
    tags:
      - '*'
jobs:
  publish:
    name: Publish new version to TER
    if: startsWith(github.ref, 'refs/tags/')
    runs-on: ubuntu-latest
    env:
      TYPO3_EXTENSION_KEY: tinyurls
      TYPO3_API_TOKEN: ${{ secrets.TYPO3_API_TOKEN }}
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Check tag
        run: |
          if ! [[ ${{ github.ref }} =~ ^refs/tags/v[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$ ]]; then
            exit 1
          fi

      - name: Get version
        id: get-version
        run: echo "version=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV

      - name: Get comment
        id: get-comment
        run: |
          git fetch --depth=1 origin +refs/tags/*:refs/tags/*
          readonly local comment=$(git tag -l --format='%(contents:subject)' v${{ env.version }} | sed "s/^v[0-9.]*[ ]*//g")

          if [[ -z "${comment// }" ]]; then
            echo "comment=Released version ${{ env.version }} of ${{ env.TYPO3_EXTENSION_KEY }}" >> $GITHUB_ENV
          else
            echo "comment=$comment" >> $GITHUB_ENV
          fi

      - name: Setup PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: 8.3
          extensions: intl, mbstring, json, zip, curl
          tools: composer:v2

      - name: Install tailor
        run: composer global require typo3/tailor --prefer-dist --no-progress --no-suggest

      - name: Cleanup repository for TER upload
        run: touch ready_for_release.txt && bash Build/cleanup_for_ter.sh

      - name: Publish to TER
        run: php ~/.composer/vendor/bin/tailor ter:publish --comment "${{ env.comment }}" ${{ env.version }}