From 313ce3c946df69d5a3c87132fd3246856e5fecca Mon Sep 17 00:00:00 2001 From: Kira Evans Date: Thu, 16 Apr 2020 13:03:46 -0700 Subject: [PATCH 1/2] document how to create a release using the contents of a file --- README.md | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f7fc34e0..c10a12c1 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,16 @@ jobs: steps: - name: Checkout code uses: actions/checkout@master + - name: Read Release Notes + id: release_notes + run: | + CONTENTS="$(cat release_notes_latest.md)" + # allow to save as multiline string https://github.community/t5/GitHub-Actions/set-output-Truncates-Multiline-Strings/m-p/38372/highlight/true#M3322 + CONTENTS="${CONTENTS//'%'/'%25'}" + CONTENTS="${CONTENTS//$'\n'/'%0A'}" + CONTENTS="${CONTENTS//$'\r'/'%0D'}" + # set an output parameter https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-output-parameter + echo "::set-output name=contents::$CONTENTS" - name: Create Release id: create_release uses: actions/create-release@latest @@ -50,10 +60,7 @@ jobs: with: tag_name: ${{ github.ref }} release_name: Release ${{ github.ref }} - body: | - Changes in this Release - - First Change - - Second Change + body: ${{ steps.release_notes.outputs.contents }} # file contents taken from earlier step draft: false prerelease: false ``` From dcf11047e5018d606270008ed618edf5514d30bd Mon Sep 17 00:00:00 2001 From: Kira Evans Date: Thu, 16 Apr 2020 13:14:23 -0700 Subject: [PATCH 2/2] use existing action instead of bash code --- README.md | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index c10a12c1..d144df70 100644 --- a/README.md +++ b/README.md @@ -44,14 +44,9 @@ jobs: uses: actions/checkout@master - name: Read Release Notes id: release_notes - run: | - CONTENTS="$(cat release_notes_latest.md)" - # allow to save as multiline string https://github.community/t5/GitHub-Actions/set-output-Truncates-Multiline-Strings/m-p/38372/highlight/true#M3322 - CONTENTS="${CONTENTS//'%'/'%25'}" - CONTENTS="${CONTENTS//$'\n'/'%0A'}" - CONTENTS="${CONTENTS//$'\r'/'%0D'}" - # set an output parameter https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-output-parameter - echo "::set-output name=contents::$CONTENTS" + juliangruber/read-file-action@v1 + with: + path: ./release_notes_latest.md - name: Create Release id: create_release uses: actions/create-release@latest @@ -60,7 +55,7 @@ jobs: with: tag_name: ${{ github.ref }} release_name: Release ${{ github.ref }} - body: ${{ steps.release_notes.outputs.contents }} # file contents taken from earlier step + body: ${{ steps.release_notes.outputs.content }} # file contents taken from earlier step draft: false prerelease: false ```