Publish #34
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish | |
| on: | |
| push: | |
| tags: | |
| - "*" | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: 'The tag to publish' | |
| required: true | |
| jobs: | |
| publish: | |
| name: Publish new version to TER | |
| if: (startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch') && (github.repository == 'benjaminkott/bootstrap_package') | |
| runs-on: ubuntu-latest | |
| env: | |
| TYPO3_EXTENSION_KEY: ${{ secrets.TYPO3_EXTENSION_KEY }} | |
| TYPO3_API_TOKEN: ${{ secrets.TYPO3_API_TOKEN }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.inputs.tag || github.ref }} | |
| - name: Get version | |
| id: get-version | |
| run: | | |
| if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then | |
| echo "version=${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT | |
| else | |
| echo "version=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Check tag | |
| run: | | |
| if ! [[ ${{ steps.get-version.outputs.version }} =~ ^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$ ]]; then | |
| exit 1 | |
| fi | |
| - name: Get comment | |
| id: get-comment | |
| run: | | |
| git fetch --tags | |
| readonly local comment=$(git tag -n10 -l ${{ steps.get-version.outputs.version }} | sed "s/^[0-9.]*[ ]*//g") | |
| if [[ -z "${comment// }" ]]; then | |
| echo "comment=Released version ${{ steps.get-version.outputs.version }} of ${{ env.TYPO3_EXTENSION_KEY }}" >> $GITHUB_OUTPUT | |
| else | |
| echo "comment=$comment" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: 7.4 | |
| extensions: intl, mbstring, json, zip, curl | |
| - name: Install tailor | |
| run: composer global require typo3/tailor --prefer-dist --no-progress --no-suggest | |
| - name: Publish to TER | |
| run: php ~/.composer/vendor/bin/tailor ter:publish --comment "${{ steps.get-comment.outputs.comment }}" ${{ steps.get-version.outputs.version }} |