Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: publish
on:
push:
tags:
- '*'

jobs:
publish:
name: Ensure GitHub Release with extension TER artifact and publishing to TER
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
env:
TYPO3_EXTENSION_KEY: ${{ secrets.TYPO3_EXTENSION_KEY }}
TYPO3_API_TOKEN: ${{ secrets.TYPO3_API_TOKEN }}
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Verify tag
run: |
if ! [[ ${{ github.ref }} =~ ^refs/tags/[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$ ]]; then
echo "ERR: Invalid publish version tag: ${{ github.ref }}"
exit 1
fi

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

- name: Get comment
id: get-comment
run: |
{
echo 'terReleaseNotes<<EOF'
echo "https://github.com/fgtclb/academic-persons/releases/tag/${{ env.version }}"
echo EOF
} >> "$GITHUB_ENV"

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

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

# Note that step will fail when `env.version` does not match the `ext_emconf.php` version.
- name: Create local TER package upload artifact
run: |
php ~/.composer/vendor/bin/tailor create-artefact ${{ env.version }}

# Note that when release already exists for tag, only files will be uploaded and lets this acting as a
# fallback to ensure that a real GitHub release is created for the tag along with extension artifacts.
- name: Create release and upload artifacts in the same step
uses: softprops/action-gh-release@v2
if: ${{startsWith(github.ref, 'refs/tags/') }}
with:
name: "[RELEASE] ${{ env.version }}"
generate_release_notes: true
files: |
tailor-version-artefact/${{ env.TYPO3_EXTENSION_KEY }}_${{ env.version }}.zip
LICENSE
fail_on_unmatched_files: true

- name: Publish to TER
run: |
php ~/.composer/vendor/bin/tailor ter:publish --comment "${{ env.terReleaseNotes }}" ${{ env.version }} \
--artefact=tailor-version-artefact/${{ env.TYPO3_EXTENSION_KEY }}_${{ env.version }}.zip
53 changes: 0 additions & 53 deletions .github/workflows/publish.yml.disabled

This file was deleted.

6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ var
/*.http
http-client.env.json
/.test-results
Build/testing-docker/.env
/Build/testing-docker/.env
/config/
Build/node_modules/
vendor
/vendor
/tailor-version-artefact/
/tailor-version-upload/
58 changes: 58 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,61 @@ DeepL Translate Extension for TYPO3.
* [Hochschule für Musik Würzburg](https://www.hfm-wuerzburg.de)
* [Carl von Ossietzky Universität Oldenburg](https://uol.de/)
* [Friedrich-Ebert-Stiftung](https://www.fes.de)

## Create a release (maintainers only)

Prerequisites:

* git binary
* ssh key allowed to push new branches to the repository
* GitHub command line tool `gh` installed and configured with user having permission to create pull requests.

**Prepare release locally**

> Set `RELEASE_BRANCH` to branch release should happen, for example: 'main'.
> Set `RELEASE_VERSION` to release version working on, for example: '5.0.0'.

```shell
echo '>> Prepare release pull-request' ; \
RELEASE_BRANCH='main' ; \
RELEASE_VERSION='5.0.1' ; \
git checkout main && \
git fetch --all && \
git pull --rebase && \
git checkout ${RELEASE_BRANCH} && \
git pull --rebase && \
git checkout -b prepare-release-${RELEASE_VERSION} && \
composer require --dev "typo3/tailor" && \
./.Build/bin/tailor set-version ${RELEASE_VERSION} && \
composer remove --dev "typo3/tailor" && \
git add . && \
git commit -m "[TASK] Prepare release ${RELEASE_VERSION}" && \
git push --set-upstream origin prepare-release-${RELEASE_VERSION} && \
gh pr create --fill-verbose --base ${RELEASE_BRANCH} --title "[TASK] Prepare release for ${RELEASE_VERSION} on ${RELEASE_BRANCH}" && \
git checkout main && \
git branch -D prepare-release-${RELEASE_VERSION}
```

Check pull-request and the pipeline run.

**Merge approved pull-request and push version tag**

> Set `RELEASE_PR_NUMBER` with the pull-request number of the preparation pull-request.
> Set `RELEASE_BRANCH` to branch release should happen, for example: 'main' (same as in previous step).
> Set `RELEASE_VERSION` to release version working on, for example: `0.1.4` (same as in previous step).

```shell
RELEASE_BRANCH='main' ; \
RELEASE_VERSION='5.0.1' ; \
RELEASE_PR_NUMBER='123' ; \
git checkout main && \
git fetch --all && \
git pull --rebase && \
gh pr checkout ${RELEASE_PR_NUMBER} && \
gh pr merge -rd ${RELEASE_PR_NUMBER} && \
git tag ${RELEASE_VERSION} && \
git push --tags
```

This triggers the `on push tags` workflow (`publish.yml`) which creates the upload package,
creates the GitHub release and also uploads the release to the TYPO3 Extension Repository.