From 6343fdffe8699e9558c791af5c7fc52aed41f56b Mon Sep 17 00:00:00 2001 From: Dmitry Nefedov Date: Sun, 18 Sep 2022 22:33:01 +0300 Subject: [PATCH] Update Sophia.yml --- .github/workflows/Sophia.yml | 44 +++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/.github/workflows/Sophia.yml b/.github/workflows/Sophia.yml index e67764c7..c436afd8 100644 --- a/.github/workflows/Sophia.yml +++ b/.github/workflows/Sophia.yml @@ -301,22 +301,30 @@ jobs: "$($_.Name) $((Get-FileHash -LiteralPath $_.FullName -Algorithm SHA256).Hash)" } | Add-Content -Path SHA256SUM -Encoding Default -Force - - name: Upload archives to release - uses: svenstaro/upload-release-action@master - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: Sophia*.zip - tag: ${{ github.ref }} - overwrite: true - file_glob: true - prerelease: true - - - name: Upload archives to release - uses: svenstaro/upload-release-action@master + - name: ReleaseNotesTemplate + id: read_release + run: | + $Parameters = @{ + Uri = "https://api.github.com/repos/farag2/Sophia-Script-for-Windows/releases" + UseBasicParsing = $true + Verbose = $true + } + $Penultimate = (Invoke-RestMethod @Parameters).tag_name | Select-Object -Index 1 + + # https://en.wikipedia.org/wiki/Percent-encoding + $Release = (Get-Content -Path ReleaseNotesTemplate.md -Encoding utf8 -Raw).replace("%", "%25").replace("`n", "%0A").replace("`r", "%0D").replace("NewVersion", "${{ github.ref_name }}").replace("OldVersion", $Penultimate) + + # https://trstringer.com/github-actions-multiline-strings/ + echo "::set-output name=RELEASE_BODY::$Release" + $ReleaseName = Get-Date -f "dd.MM.yyyy" + echo "RELEASE_NAME=$ReleaseName" >> $env:GITHUB_ENV + + - name: Uploading + uses: softprops/action-gh-release@master with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: SHA256SUM - tag: ${{ github.ref }} - overwrite: true - file_glob: true - prerelease: true + name: ${{ env.RELEASE_NAME }} + token: ${{ github.token }} + files: | + Sophia*.zip + SHA256SUM + body: ${{ steps.read_release.outputs.RELEASE_BODY }}