Fix EOF error in release PR action (#319)
This commit is contained in:
parent
4562c0f2f9
commit
361e5530c5
|
@ -82,27 +82,23 @@ jobs:
|
|||
- name: Create PR
|
||||
run: |
|
||||
set -euxo pipefail
|
||||
|
||||
nl=$'\n'
|
||||
br=$'\n\n'
|
||||
fence='```\n'
|
||||
ecnef='\n```'
|
||||
|
||||
title="release: ${{ inputs.crate }} v${{ inputs.version }}"
|
||||
body="This is a release PR for **${{ inputs.crate }}** to version **${{ inputs.version }}**."
|
||||
body_intro="This is a release PR for **${{ inputs.crate }}** to version **${{ inputs.version }}**."
|
||||
if [[ "${{ inputs.crate }}" == "cli" ]]; then
|
||||
body="$body
|
||||
|
||||
Upon merging, this will automatically build the CLI and create a GitHub release. You still need to manually publish the cargo crate."
|
||||
body_merge="Upon merging, this will automatically build the CLI and create a GitHub release. You still need to manually publish the cargo crate."
|
||||
else
|
||||
body="$body
|
||||
|
||||
Upon merging, you will still need to manually publish the cargo crate."
|
||||
body_merge="Upon merging, you will still need to manually publish the cargo crate."
|
||||
fi
|
||||
body="$body
|
||||
|
||||
\`\`\`
|
||||
$ cd crates/${{ env.crate_path }}
|
||||
$ cargo publish
|
||||
\`\`\`
|
||||
body_outro="${fence}$ cd crates/${{ env.crate_path }}${nl}$ cargo publish${ecnef}${br}To merge this release, review the changes then say:${br}\`bors r+ p=10\`"
|
||||
|
||||
To merge this release, review the changes then say:
|
||||
|
||||
`bors r+ p=10`
|
||||
body="${body_intro}${br}${body_merge}${br}${body_outro}"
|
||||
|
||||
gh pr create --title "$title" --body "$body" --base main --head "${{ env.branch_name }}" --label "release"
|
||||
env:
|
||||
|
|
|
@ -15,20 +15,12 @@ jobs:
|
|||
if: "startsWith(github.event.head_commit.message, 'release: ')"
|
||||
steps:
|
||||
- name: Extract tag from commit message
|
||||
env:
|
||||
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
|
||||
run: |
|
||||
set -euxo pipefail
|
||||
|
||||
read -r -d '' message <<'COMMITMESSAGESEPARATOR'
|
||||
${{ github.event.head_commit.message }}
|
||||
COMMITMESSAGESEPARATOR
|
||||
|
||||
# trim both ends
|
||||
message="${message#"${message%%[![:space:]]*}"}"
|
||||
message="${message%"${message##*[![:space:]]}"}"
|
||||
|
||||
# get first line
|
||||
message="$(head -n1 <<< "$message")"
|
||||
|
||||
message="$(head -n1 <<< "$COMMIT_MESSAGE")"
|
||||
crate="$(cut -d ' ' -f 2 <<< "${message}")"
|
||||
version="$(cut -d ' ' -f 3 <<< "${message}")"
|
||||
echo "CUSTOM_TAG=${crate}-${version}" >> $GITHUB_ENV
|
||||
|
|
Loading…
Reference in New Issue