From f68e2a4f85adbc6f117315dc050bb007fbe647db Mon Sep 17 00:00:00 2001 From: shawly Date: Wed, 24 Jul 2024 19:10:58 +0200 Subject: [PATCH] ci(update-readme): fix sed syntax issues --- .github/workflows/docker-publish.yml | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index dba6029..15bd00f 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -257,28 +257,32 @@ jobs: uses: actions/checkout@v4 with: ref: main - - - name: Prepare variables + + - name: Set start and end comment if: needs.build.outputs.publish == 'true' - id: prep + id: comment run: | - README_TAGS=$(jq -r '"- " + (.[] | [.tags[] | "`" + . + "`"] | join(", "))' <<< '${{ needs.build-matrix.outputs.releases }}') - # Replace supported tags in README.md # Define the start and end comments in the README.md file if [ "${{ github.ref }}" != "refs/heads/main" ]; then - start_comment='' - end_comment='' + echo 'start_comment=' >> "$GITHUB_OUTPUT" + echo 'end_comment=' >> "$GITHUB_OUTPUT" else - start_comment='' - end_comment='' + echo 'start_comment=' >> "$GITHUB_OUTPUT" + echo 'end_comment=' >> "$GITHUB_OUTPUT" fi + - name: Prepare variables + if: needs.build.outputs.publish == 'true' + id: prep + run: | + README_TAGS=$(jq -r '"- " + (.[] | [.tags[] | "`" + . + "`"] | join(", "))' <<< '${{ needs.build-matrix.outputs.releases }}') + # Cleanout space between start and end comment - sed -i '/'${start_comment}'/,/'${end_comment}'/ { //!d }' README.md + sed -i '/${{ steps.comment.outputs.start_comment }}/,/${{ steps.comment.outputs.end_comment }}/ { //!d }' README.md # Replace the tags - sed -i "\\~${start_comment}~,\\~${end_comment}~ { \\|${start_comment}|r /dev/stdin + sed -i "\\~${{ steps.comment.outputs.start_comment }}~,\\~${{ steps.comment.outputs.end_comment }}~ { \\|${{ steps.comment.outputs.start_comment }}|r /dev/stdin }" README.md <<< "$README_TAGS" - name: Check for modified files