From d7cc44331dda777648cb4c2e15c69cccd86f0914 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20B=C3=BCrk?= Date: Fri, 14 Feb 2025 11:40:07 +0100 Subject: [PATCH] [DOCS] Simplify workflow examply in `README.md` The `README.md` contains a GitHub workflow example for publishing in on pushed tags and extracts from a annotated tag content created with ```shell git tag -a -m "some content" ``` filtering the git tag list for the extracted version and telling to display max 10 lines for the content, and extracting the tag prefix from the first line using a `sed` regexp pattern. `git` provides a simpler way using the `format` option, which this change adopts in the aforementioned example. To be precise, following: ```shell git tag -n10 -l ${{ env.version }} | sed "s/^[0-9.]*[ ]*//g" ``` is replaced with ```shell git tag -l ${{ env.version }} --format '%(contents)' ``` which displays only the tag content and removes the need to extract the tag from the first line. --- README.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9091623..9610567 100644 --- a/README.md +++ b/README.md @@ -509,6 +509,8 @@ on: jobs: publish: name: Publish new version to TER + # use folliwing if tags begins with `v` + # if: startsWith(github.ref, 'refs/tags/v') if: startsWith(github.ref, 'refs/tags/') runs-on: ubuntu-20.04 env: @@ -520,6 +522,7 @@ jobs: - name: Check tag run: | + # use ^refs/tags/v[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$ when tag is prefixed with v if ! [[ ${{ github.ref }} =~ ^refs/tags/[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$ ]]; then exit 1 fi @@ -531,7 +534,9 @@ jobs: - name: Get comment id: get-comment run: | - readonly local comment=$(git tag -n10 -l ${{ env.version }} | sed "s/^[0-9.]*[ ]*//g") + # If tag begins with `v` use: + # readonly local comment=$(git tag -l v${{ env.version }} --format '%(contents)) + readonly local comment=$(git tag -l ${{ env.version }} --format '%(contents)) if [[ -z "${comment// }" ]]; then echo "comment=Released version ${{ env.version }} of ${{ env.TYPO3_EXTENSION_KEY }}" >> $GITHUB_ENV @@ -575,7 +580,7 @@ ${GITHUB_REF#refs/tags/v} 3. The variable declaration in step **Get comment** should be: ```bash -$(git tag -n10 -l v${{ env.version }} | sed "s/^v[0-9.]*[ ]*//g") +$(git tag -l v${{ env.version }} --format '%(contents)) ``` #### GitHub actions from TYPO3 community